Plot time along the y-axis?

I can't seem to find a built-in way so I propose an extension of my old axisFlip routine:

axisFlip = # /. {x_Point | x_Line | x_GraphicsComplex :> MapAt[# ~Reverse~ 2 &, x, 1], 
     x : ((PlotRange | FrameTicks) -> _) :> x ~Reverse~ 2} &;

DateListPlot[{1, 1, 2, 3, 5, 8, 11}, {2000, 8}] // axisFlip

enter image description here

DateListPlot[{1, 1, 2, 3, 5, 8, 11}, {2000, 8}, Joined -> False] // axisFlip

enter image description here

This should work with TimeObject as well; let me know if it doesn't.


It looks like DataListPlot does not understand TimeObjects. You can convert them to Quantity "Hours" and plot this instead.

data = {{DateObject[{2016, 1, 1}], TimeObject[{6, 0, 0}]},
        {DateObject[{2016, 1, 2}], TimeObject[{8, 0, 0}]}};

hrData = MapAt[UnitConvert[Total@DateValue[#, {"Hour", "Minute", "Second"}, Quantity], "Hours"] &, {All, 2}]@data

{{DateObject[{2016, 1, 1}], Quantity[6, "Hours"]}, {DateObject[{2016, 1, 2}], Quantity[8, "Hours"]}}

Then plot hrData

DateListPlot[hrData, FrameLabel -> Automatic, 
 DateTicksFormat -> {"MonthNameShort", " ", "Day"}]

enter image description here

The y-axis is in hours and gets an automatic "h" frame label.

Hope this helps.