[R] Grid-drawing in plot.its OR how to influence axTicks

Schneider, Manuel Manuel.Schneider at eawag.ch
Wed May 23 09:53:56 CEST 2007


Dear List,

I am ploting an its object with user-specified ticks on the x axis, but
cannot figure out how to adjust the plotted grid to these ticks.

> temp <- its(1:3,dates=as.POSIXct(strptime(c("1999-12-31
01:00:00","2000-01-01 02:00:00","2000-01-10 02:00:00"),format="%Y-%m-%d
%X")))
> plot(temp)
Gives the grid alined with the ticks on the y-axis but not on the x-axis

> d<-as.POSIXct(round(range(dates(temp)),"days"))
> atTicks<-seq(d[1], d[2], by="day")
> plot(temp, at=atTicks)
Gives daily ticks but does not affect the grid

> axTicks(1)
[1] 946600000 946800000 947000000 947200000 947400000
> unclass(atTicks)
 [1] 946594800 946681200 946767600 946854000 946940400 947026800
947113200
 [8] 947199600 947286000 947372400 947458800
attr(,"tzone")
[1] ""
axTicks(1) gives where grid is drawn, unclass(atTicks) gives where the
Ticks are (and where I would like the grid is drawn).

> plot(temp, at=atTicks,
xaxp=c(unclass(range(atTicks)),length(atTicks)-1))
Does not help and my question simply is how to make axTicks(1) to be
unclass(atTicks).

Many thanks for any hints.

Manuel



More information about the R-help mailing list