[R] Chron object in time series plot

Gabor Grothendieck ggrothendieck at gmail.com
Mon Oct 25 22:35:42 CEST 2010


On Mon, Oct 25, 2010 at 4:12 PM, Manta <mantino84 at libero.it> wrote:
>
> I apologize for not being very precise. I meant the tick marks on the x-axis.
>
> As for the code, the situation is just the one describe above, just that I
> would like to be able to specify the tick marks (say every 3 or 6 months).

Using z and zjj from before:

plot(z, xaxt = "n")
axis(1, as.Date(time(zjj)), time(zjj))

or fancier:

plot(z, xaxt = "n")
jan <- as.numeric(format(time(zjj), "%m")) == 1
tt <- time(zjj)
axis(1, as.Date(tt)[jan], format(tt[jan], "%Y"))
axis(1, as.Date(tt)[!jan], format(tt, "%b")[!jan], tcl = -0.2)

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list