[R] Formatting POSIXt values in plot axis labels

Jason Turner jasont at indigoindustrial.co.nz
Mon Aug 5 22:32:15 CEST 2002


On Mon, Aug 05, 2002 at 02:23:07PM -0700, Ronnen Levinson wrote:
> Hello.
> 
> I have an XYY series that I would like to graph with matplot() or some
> other single function that will do the trick.
> The X in question is a vector of POSIXt values obtained from strptime().
> 
...
> Is there a way for me to give plot() and/or
> matplot() formatting instructions for POSIXt values?
> 

Yup.  In two steps...

1) plot, but without a labeled x-axis (x.stuff should have 
class "POSIXct"):

matplot(x.stuff, y.stuff, xaxt="n")


2) you can now use axis.POSIXct()
And a very nice function it is.  You can tell it where to put
the ticks (if you don't find the defaults appropriate), and what
format to display the dates.

Cheers

Jason
-- 
Indigo Industrial Controls Ltd.
64-21-343-545
jasont at indigoindustrial.co.nz
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list