0
$\begingroup$

I am creating a TimeLinePlot with text bubbles connected to the time interval lines. The option PlotLayout -> "Stacked" ensures the interval lines do not overlap but I can't figure out how to prevent the text bubbles from overlapping.

See MWE below.

As a bonus question - any idea how to rotate the Tick labels? FrameTicksStyle -> Directive[TickLabelOrientation -> "Vertical"] seems to be ignored in a TimeLinePlot?

Thanks.

ClearAll["`*"]

titles = {"aaaaaaaa", "bbbbbbbbbb", "cccccccccc", "ddddddddd", 
   "eeeeeeeee", "fffffffffff", "gggggggggg", "hhhhhhhhh", "iiiiiiiiii",
    "jjjjjjjjjjj", "kkkkkkkkk"};

start = {"11/7/2020", "7/4/2021", "12/6/2021", "3/30/2022", 
   "11/18/2022", "3/13/2023", "10/19/2023", "4/24/2024", "8/6/2024", 
   "1/4/2025", "7/5/2025"};
stop = {"1/3/2021", "8/14/2021", "1/19/2022", "7/3/2022", "1/8/2023", 
   "5/8/2023", "12/3/2023", "6/2/2024", "10/13/2024", "3/15/2025", 
   "8/22/2025"};

begin = FromDateString[start];
end = FromDateString[stop]
days = Table[DateDifference[begin[[i]], end[[i]]], {i, 1, 11}];

bubbles = Table[titles[[i]] <> "\n" <> ToString[days[[i]]], {i, 1, 11}];

tlp = Table[DateInterval[{begin[[i]], end[[i]]}], {i, 1, 11}];

TimelinePlot[AssociationThread[bubbles -> tlp],
 PlotStyle -> Directive[Black, AbsoluteThickness[3]],
 PlotLayout -> "Stacked", LabelStyle -> Directive[Blue, 14, Bold],
 FrameStyle -> Directive[Black, AbsoluteThickness[3] 18, Bold], 
 Frame -> True, AspectRatio -> 1/2, ImageSize -> {1400, 1400},
 FrameTicks -> {{None, None}, {begin, None}},
 FrameTicksStyle -> Directive[TickLabelOrientation -> "Vertical"],
 FrameLabel -> "Starting Date", 
 DateTicksFormat -> {"MonthShort", "/", "Day", "/", "YearShort"}]

enter image description here

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.