I am making a ListPlot, in which the x-axis is the result of AbsoluteTime. I want the tick text to be human-readable by applying DateString, but don't want to mess with the automatic tick length. Is this possible? Thanks!
Asked
Active
Viewed 607 times
4
arax
- 1,831
- 12
- 16
1 Answers
7
Unless you specify the tick mark length in your tick specifications tick marks are rendered with default length and style.
tickF = {#, DateString[#, {"MonthNameShort", " ", "Day", "/", "YearShort"}]} & /@
AbsoluteTime /@ DateRange[##, {10, "Day"}] &;
Example data:
data = {{3368649600, 8}, {3369427200, 10}, {3370291200, 12}, {3370636800, 14},
{3371673600, 15}, {3372537600, 20}};
If you have to use ListPlot:
ListPlot[data, Frame -> True, Axes -> False, PlotRange -> Full,
FrameTicks -> {tickF, Automatic, Automatic, Automatic},
GridLines -> {First /@ tickF[##] &, None}]

If not, DateListPlot is more convenient to use for your data structure:
DateListPlot[data, PlotRange -> Full,
FrameTicks -> {tickF, Automatic, Automatic, Automatic}]

kglr
- 394,356
- 18
- 477
- 896
DateListPlot? – Kuba Mar 02 '15 at 10:42Rotate? – Sjoerd C. de Vries Mar 02 '15 at 11:49