On 04/04/2010 08:52 PM, zow...@ncst.go.ke wrote:
Dear all,

I am plotting daily data from 1950 to  2000 and I wish to have the time in
X-axis to indicate years and NOT days (i.e 1950 1951,......,2000 instead of
1,2, 3, ......).
How do I set the x-axis to show years instead of days.

Hi Zablone,
At a guess, try this:

plot(...,xaxt="n")
axis(1,at=1:51,labels=1950:2000)

although unless you have a _very_ wide plot, only a few of the labels will be shown, so you may want:

axis(1,at=seq(1,51,by=10),labels=seq(1950,2000,by=10))

or if you really want those 51 labels:

plot(...,xaxt="n",xlab="")
library(plotrix)
staxlab(1,at=1:51,labels=1950:2000,nlines=4)

Jim

______________________________________________
R-help@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.

Reply via email to