[R] adjusting grid on Xaxis ticks

jim holtman jholtman at gmail.com
Fri Jul 24 12:41:16 CEST 2009


is this what you want:

plot(0, xlim=as.POSIXct(c('2009-01-01', '2009-12-31')), xaxt='n')
x <- seq(as.POSIXct('2009-01-01'), as.POSIXct('2009-12-13'), by='1 month')
axis(1, at=x, labels=format(x, "%b"))
abline(v=x, lty=2)


On Thu, Jul 23, 2009 at 11:37 PM, wapita wapita<wapita at hotmail.com> wrote:
>
> Hello,
> I have been trying to plot correctly a graph for 2 month now, with no success.I want to put a grid, adjusted on the X axis tickers.
> Here is the way I build my X-Axis and my grid:
>
>
> grid(11, NULL, col="grey40")
> axis(2)
>
> # build the tickers on the beginning of each monthticks.at <- seq(ISOdatetime(lastYear, 01, 01, hour=0, min=0, sec=0, tz="GMT"), ISOdatetime(lastYear, 12, 31, hour=0, min=0, sec=0, tz="GMT"), by = "months")
> ticks.lab <- format(ticks.at, format = "%b")
> Axis(ISOdatetime(lastYear, substr(index(xts1),6,7), substr(index(xts1),9,10), hour=0, min=0, sec=0, tz="GMT"), at = ticks.at, side = 1, labels = ticks.lab, las = 2)
> box()
>
>
> If anyone can help me, I would be very grateful.
> Xavier
> _________________________________________________________________
>
> [[elided Hotmail spam]]
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list