Re: Re: plot time vs date
- To: mathgroup at smc.vnet.net
- Subject: [mg26539] Re: [mg26490] Re: [mg26461] plot time vs date
- From: Maarten.vanderBurgt at icos.be
- Date: Wed, 3 Jan 2001 04:08:53 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hallo, Is there a way I can rotate the tick marks labels on the x-axis over 90 degrees? thanks Maarten Leuven, Belgium BobHanlon at aol.com on 28-12-2000 08:52:28 AM Subject: [mg26539] [mg26490] Re: [mg26461] plot time vs date Use seconds for both axes and label the Ticks in the format that you want. toStringPair[x_Integer?NonNegative] := ToString[PaddedForm[x, 2, NumberPadding -> {"0", "0"}, NumberSigns -> {"", ""}]]; secPerDay = 24 * 60 * 60; months = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; startDate = {2000, 12, 1, 12, 0, 0}; (* Dec 1, 2000; 12 : 00 : 00 *) endDate = {2000, 12, 31, 12, 0, 0}; (* Dec 31, 2000; 12 : 00 : 00 *) xmin = FromDate[startDate]; (* seconds *) xmax = FromDate[endDate]; (* seconds *) ymin = 8*60*60; (* seconds in eight hours = > 8 : 00 : 00 *) ymax = 12*60*60; (* seconds in twelve hours = > 12 : 00 : 00 *) ystep = 10*60; (* 10 minutes *) data = Table[{Random[ Integer, {xmin, xmax}], Random[Integer, {ymin, ymax}]}, {25}]; ListPlot[data, Ticks -> { Join[ Table[{x, months[[#1]] <> "-" <> toStringPair[#2] & @@ Rest[Drop[ToDate[x], -3]], {0.01, 0.}, {GrayLevel[0.], AbsoluteThickness[0.25]}}, {x, xmin, xmax, 5*secPerDay}], Table[{x, "", {0.004, 0.}, {GrayLevel[0.], AbsoluteThickness[0.125]}}, {x, xmin - secPerDay, xmax + secPerDay, secPerDay}]], Join[ Table[{y, #1 <> ":" <> #2 & @@ (toStringPair /@ Drop[Drop[ToDate[y], 3], -1]), {0.01, 0.}, {RGBC, AbsoluteThickness[0.25]}}, {y, ymin, ymax, 3*ystep}], Table[{y, "", {0.004, 0.}, {GrayLevel[0.], AbsoluteThickness[0.125]}}, {y, ymin - ystep, ymax + ystep, ystep}]]}, PlotStyle -> {AbsolutePointSize[3], RGBColor[1, 0, 0]}, PlotRange -> {{xmin - 2*secPerDay, xmax + secPerDay}, {ymin - ystep, ymax + ystep}}, AxesOrigin -> {xmin - 2*secPerDay, ymin - ystep}, ImageSize -> {500, 310}]; Bob Hanlon In a message dated 12/21/00 11:24:25 PM, Maarten.vanderBurgt at icos.be writes: >How do I make a plot with time (format hh:mm) on the ordinate and date >( >format MMM-dd) on the abscissa? >