Label X Axis in Time Series Plot using R

后端 未结 5 1573
無奈伤痛
無奈伤痛 2020-12-01 07:02

I am somewhat new to R and have limited experience with plotting in general. I have been able to work get my data as a time series object in R using zoo, but I am having a

5条回答
  •  伪装坚强ぢ
    2020-12-01 07:50

    plot.zoo uses the axis functions in R's classic graphics but zoo also offers lattice graphics as well via xyplot.zoo. Just changing plot to xyplot may be sufficient for your needs:

    library(zoo)
    library(lattice)
    
    # create test data
    z <- zooreg(1:83, start = as.Date("2009-04-01"), deltat = 7)
    
    xyplot(z)
    

    Note that there are further examples in ?plot.zoo and ?xyplot.zoo as well as the three vignettes that come with zoo. In those places you can also find find examples of a different approach showing how to use the axis function of classic graphics together with plot.zoo for highly customized axes.

提交回复
热议问题