[R-SIG-Finance] How to add grid to plot.zoo easily

Wind windspeedo at qq.com
Sun Jan 11 12:17:04 CET 2009


The grid() could add grids to plot easily.   But the vertical grids are not at the positions of  major ticks if we plot the time series.   
I am satisfied with the major ticks generated by plot.zoo function.    Could we just add grids to plot.zoo according to the major ticks genereated by plot.zoo?    

The following codes work well except that the vertical grids not at the position of major ticks of x axis.

>require(RODBC)
>require(zoo)
>stock1<-getSymbol.RE("SH600036")
>>head(stock1)
               Open     High      Low    Close Volume
2002-04-09 4.288226 4.439191 4.288226 4.349428 101491
2002-04-10 4.349428 4.365749 4.239264 4.324947  16651
2002-04-11 4.324947 4.357588 4.280066 4.292306   5583
2002-04-12 4.284146 4.341268 4.275985 4.312707   5208
2002-04-15 4.312707 4.324947 4.222944 4.239264   4541
2002-04-16 4.222944 4.239264 4.137261 4.145421   6107
> plot(stock1$Close)
> grid()
> 


More information about the R-SIG-Finance mailing list