Formatting Ticks on TimeLinePlot

Hi everyone,

Is there a way to force TimeLinePlot to display ticks and tick labels only for the dates of the events themselves? Here’s an example containing an interval, Feb 1973 through May 2013, and an event occurring on a specific date, Feb 7, 2011.

data = {
   {
    Labeled[DateInterval[{{1973, 09, 01}, {2013, 05, 31}}], 
     "Events spans an interval"],
    Labeled[{2011, 02, 07}, "Event on a specific date"]}
   };

TimelinePlot[data, PlotLayout -> "Horizontal",
 DateTicksFormat -> {"MonthNameShort", " ", "Year"},
 PlotRange -> {{1970, 01, 01}, {2022, 11, 01}},
 ImageSize -> {Automatic, 300}]

When I run this, I get a timeline whose ticks marks are spaced two years apart (see attached file) and labelled as such, but what I want to show is a tick mark and label only for the three dates in my data. Is there a way to do that using the Ticks option?

Greg

Timeline.pdf (52.9 KB)

Just figured it out.

Hi Greg,

I’m interested. can you let me know how you solved it?

Thanks in advance! … Jos

Hi Jos,

Sorry for late reply. Have a look at this.

timelineData = <|
   "Rock Around the Clock" -> "1954-05-20",
   "All Along the Watchtower" -> "1967-12-07",
   "Sultans of Swing" -> "1978-05-19"
   |>;

TimelinePlot[timelineData,
 AspectRatio -> 1/8,
 Ticks -> {Values[timelineData], 
   Automatic},(*restrict the ticks to just the dates*)
 
 DateTicksFormat -> {"DayShort", " ", "MonthNameShort", " ", 
   "Year"},(*format the dates*)
 Spacings -> {1, 52, 34},
 BaseStyle -> {FontFamily -> "Futura", FontColor -> Black, 
   FontSize -> 11}, 
 LabelStyle -> {FontFamily -> "Futura", FontColor -> Black, 
   FontSize -> 11}, 
 PlotLabel -> 
  Style["RECORD RELEASE", FontFamily -> "Futura", FontSize -> 14, 
   FontColor -> Black], ImageSize -> 860]

Hi Gregory,

Thanks for sharing your solution. It works perfectly!

Best Regards,…Jos