1
$\begingroup$

I would like to generate a plot with the y axis on the graph. In a "normal" numeric plot I do this using the AxesOrigin option. How to I specify the crossing point in a DateListPlot?

Here's the MWE of a DateListPlot graph. In this example I would like the y axis to cross the x axis at 4/20. How do I specify the crossing coordinates?

data = RandomInteger[100, 50];
DateListPlot[data, {2020, 3, 1}, ImageSize -> {500, 500}, 
PlotStyle -> Red, DateTicksFormat -> {"MonthShort", "/", "Day"}]

enter image description here

$\endgroup$
2
  • 3
    $\begingroup$ Your data only goes up to April 19. So is the question how to move the vertical scale from the left edge to the right edge? That would be done with something like FrameTicks -> {{None, All}, {Automatic, Automatic}} $\endgroup$ – Brett Champion May 6 '20 at 3:19
  • $\begingroup$ Thanks for you help. Sorry about the 4/20 - I was trying to get to the end of the axis. Your solution works fine. $\endgroup$ – jmm May 10 '20 at 3:40
0
$\begingroup$

Table[DateListPlot[Range[10], {2007}, AxesOrigin -> {"July 1, " <> ToString[2006 + i], 0}, Axes -> True, Frame -> False], {i, 1, 10}]

DateListPlot with moving x-axis based on AxesOrigin

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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