5

enter image description here

The code below generates the plot above,

DateListPlot[{Drop[series[7], 1], Drop[series[16], 1]},Joined -> True, 
              PlotMarkers -> {Automatic, Small}, Frame -> True,
              DateTicksFormat -> {"MonthNameShort", " ", "YearShort"} ] /.
              x : (FrameTicks -> _) :> (x /. s_String :> Rotate[s, 90 Degree])

I would like to show, on the x-axis, each and every one of the dates for which I have data. If that gets too cluttered then I would like to show a sampling of it that covers some of the staggered months. I will paste this into a pdf so tooltips won't be of use. Maybe for within year data, I can mention just the month, if it will improve readability. With non-date data, I know that I can enter ticknames and tick positions but I don't know how to do it with date data and also, I was wondering if this could be automated where I could tell it to show only the month for certain dates and month-year for others.

Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453
Amatya
  • 6,888
  • 3
  • 26
  • 35

1 Answers1

10

Use the data as ticks.

data = WolframAlpha["brad pitt", 
         {{"PopularityPod:WikipediaStatsData", 1}, "TimeSeriesData"}];

rarify = data[[1 ;; -1 ;; 10]];

DateListPlot[rarify, FrameTicks -> {rarify[[All, 1]], Automatic}, 
  Filling -> Bottom, PlotMarkers -> {Automatic, Small}, Frame -> True,
   DateTicksFormat -> {"MonthNameShort", " ", "YearShort"}] /. 
 x : (FrameTicks -> _) :> (x /. s_String :> Rotate[s, 90 Degree])

enter image description here

Vitaliy Kaurov
  • 73,078
  • 9
  • 204
  • 355
  • Thanks! That works. Can you please tell me what you've done to select or sample from the large data that you had.. the [[1;;-1;;10]] command. – Amatya Dec 26 '13 at 20:46
  • 1
    @Amatya this means from 1st element (1) to last (-1) taking each 10th element. I did this so that ticks won't overlap and make a mess. Is this what you are asking about? – Vitaliy Kaurov Dec 26 '13 at 20:51