Message Boards Message Boards

0
|
334 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

How to set the alignment of labels in a TimelinePlot

Posted 26 days ago

Hi everyone,

The text in multi-line labels in TimelinePlots is centred by default. Here's an example:

theData =
  Association[
   "TITLE OF AN EVENT
Line 2 of an event,
Line 3 of an event" -> "1923",

   "TITLE OF ANOTHER EVENT
Line 2 of another event,
Line 3 of another event" -> "1924"
   ];

TimelinePlot[theData, 
 BaseStyle -> {FontFamily -> "Palatino", FontColor -> Black, 
   FontSize -> 12},
 PlotLayout -> "Vertical", 
 LabelStyle -> {FontFamily -> "Palatino", FontColor -> Black, 
   FontSize -> 12}, 
 PlotLabel -> 
  Style["TITLE\n subtitle\nsub-subtitle", FontFamily -> "Palatino", 
   FontSize -> 14, FontColor -> Black], AspectRatio -> Automatic, 
 ImageSize -> 540]

How can I make the text left-aligned?

Greg

POSTED BY: Gregory Lypny
2 Replies
Posted 25 days ago

Hi Greg,

One way to do this is to wrap the label with Text[Style[...]] and specify TextAlignment. E.g.

theData = Association[
  Text[Style["TITLE OF AN EVENT
Line 2 of an event,
Line 3 of an event", TextAlignment -> Left]] -> "1923",
  Text[Style["TITLE OF ANOTHER EVENT
Line 2 of another event,
Line 3 of another event", TextAlignment -> Left]] -> "1924"]
POSTED BY: Rohit Namjoshi
KeyMap[Column[StringSplit[#, {",\n", "\n"}]] &]@theData
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract