1
$\begingroup$

I have a DateListPlot with data starting at 2PM of 01/18/2017 and ending at 4AM of the next day, so there is a change of date, However it does not appear in the plot:

enter image description here

as you can see it simply writes 00:00 for midnight, however I would like that the starting day and the change of date appear in the ticks: can it be done?

$\endgroup$
5
  • $\begingroup$ Ugh. I just noticed the wrong label in the x axis, please don't mind it $\endgroup$ Commented Oct 3 at 8:31
  • 2
    $\begingroup$ It would be easier to help if you provided a minimum working example, including a subset of the data. Perhaps 1 out of every 100 points. Also the MMA version and OS. $\endgroup$ Commented Oct 3 at 19:03
  • $\begingroup$ @mattiav27 Since there aren't any answers, and the solution is trivial, you could maybe delete your question? $\endgroup$ Commented Oct 4 at 8:35
  • $\begingroup$ Something like DateTicksFormat -> {"Day", " - ", "Hour24"} ? $\endgroup$ Commented Oct 4 at 12:50
  • $\begingroup$ @RomkeBontekoe thanks that's what I wanted $\endgroup$ Commented Oct 5 at 7:22

1 Answer 1

1
$\begingroup$
times = DateRange[DateObject["2:00PM 01/18/2017" ], DateObject["4:00AM 01/19/2017" ], "Minutes"]; SeedRandom[1]; numberDensities = 4 + Accumulate[ RandomVariate[NormalDistribution[-.001, .05], Length[times]]]; timeData = Transpose[{times, numberDensities}]; ticks = DateRange; DateListPlot[timeData, PlotRange -> {All, {0, 6}}, DateTicksFormat -> {"MonthNameShort", " ", "DayShort", "\n", "Hour24", ":", "Minute"}] 

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ Variable times is not defined. $\endgroup$ Commented Oct 19 at 17:03
  • $\begingroup$ Woops, fixed now, thanks! $\endgroup$ Commented yesterday

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.