2
$\begingroup$

I would like to plot some data with SmoothHistogram3D, but one of the axis is date, and I would like the ticks to reflect that:

SeedRandom[2021];
data = Transpose[{RandomReal[{3250368000, 3250454400}, 10000], 
                  RandomReal[{0, 100}, 10000]}];
SmoothHistogram3D[data]

3D smooth histogram plot

The $x$ axis (with 10^9) should be date. This answer might be useful, especially Graphics`DateListPlotDump`DateTicks` but I did not manage to adapt it.

$\endgroup$
2
$\begingroup$

Try this:

SmoothHistogram3D[data,
 Ticks -> {
   {#, DateString[#, {"Day", "/", "Month", "/", "YearShort", " ", "Hour24Short", ":", "MinuteShort"}]} & /@ 
    FindDivisions[MinMax@data[[All, 1]], 5],
   Automatic,
   Automatic}
]

with dates and times as ticks

Look at the documentation of DateString to see how to customize the date string specification to your needs.

$\endgroup$
1
$\begingroup$

In versions 11.+, we can use System`DateListPlotDump`DateTicks to get date ticks:

SeedRandom[2021];
data = Transpose[{RandomReal[{3250368000, 3250454400}, 10000], 
   RandomReal[{0, 100}, 10000]}];

SmoothHistogram3D[data, ImageSize -> Large,
   Ticks -> {System`DateListPlotDump`DateTicks[{##}, 7,  
     {"MonthNameShort", " ", "Day", " ", "Hour", ":", "Minute"}] &, 
      Automatic, Automatic}]

enter image description here

$\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.