Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

DateListPlot very nicely chooses major and minor frame tick and frame tick label/markers.

I am building a custom graphics function where either the x or y axis is time and I would like to use whatDateListPlot provides. How can I do this without simply overlaying and using Show?

share|improve this question
2  
Looking at the FullForm of your DateListPlot might give you some ideas... –  Sjoerd C. de Vries Jun 27 '12 at 15:01
add comment

1 Answer

up vote 8 down vote accepted

Options will do it:

data = {{{2006, 10, 1}, 10}, {{2006, 10, 15}, 12},
   {{2006, 10, 30}, 15}, {{2006, 11, 20}, 20}};
plot = DateListPlot[data];
Options[plot, FrameTicks]

For example, modifying the contents of FrameTicks:

data = {DateList[{2006, #, 1}], #} & /@ Range[40];
plot = DateListPlot[data];
ticks = FrameTicks /. Options[plot, FrameTicks];
ticks[[2, 1, All, 2]] = Style[#, Red] & /@ ticks[[2, 1, All, 2]];
pos = Position[plot, FrameTicks];
plot[[Sequence @@ Most[First@pos]]] = FrameTicks -> ticks;
plot

enter image description here

share|improve this answer
3  
or plot /. (FrameTicks -> _) -> (FrameTicks -> ticks) to eliminate the 2nd and 3rd last lines. –  Mike Honeychurch Jun 27 '12 at 21:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.