[R] Plot Date

Gabor Grothendieck ggrothendieck at gmail.com
Tue Jul 11 12:53:54 CEST 2006


Try this.  We first generate some test data, then we plot the
data without the x axis.  We generate a subset of the times
consisting of a sequence of every 7 months and create an
axis with that.  Then we add smaller ticks every month.


library(zoo)

# test data
x <- seq(0, 10*365)
z <- zoo(x, as.Date("1990-01-01") + x)

plot(z, xaxt = "n")

tt <- seq(as.Date("1990-05-20"), time(z)[length(z)], by = "7 months")
axis(1, tt, format(tt, "%d/%m/%y"), cex.axis = 0.7, tcl = -0.6)

tt <- seq(as.Date("1990-01-20"), time(z)[length(z)], by = "months")
axis(1, tt, FALSE, tcl = -0.3)


On 7/11/06, Sumanta Basak <r_econometrics at yahoo.co.in> wrote:
> Hi R-Users,
>
> First of all i apologize if this is too simple for you. I want to plot an index of which i have daily data for 10 years. I want to plot specific dates in X axis, like 20/05/91     20/12/92     20/07/94   etc..... and the index value in Y axis. Please suggest me.
>
> Thanks,
> Sumanta.
>
>
> ---------------------------------
>  Find out what India is talking about on  Yahoo! Answers India.
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



More information about the R-help mailing list