On 2013-03-06 06:07, iDa wrote:
Hi!

I have problems with labeling x axis while plotting time series data. I have
40 monthly measurement. One period lasts 4 months. I'd like to have 40 ticks
on x axis (10 larger, the rest smaller) and labels just at the beginning of
each period, just like in the image
<http://r.789695.n4.nabble.com/file/n4660465/2221.jpg>

My code leaves x axis empty:

data <- read.csv(file="CSV files/Komen.csv", head=TRUE, sep=";")
dataTimeSeries <- ts(data, frequency=12, start=c(2000,4))
dataTimeSeries
      Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2000               7  45  47   3  24 132  35  32  28
2001 161  48  31  33 161 154 420  19 149  44  54  16
2002 152  94  43  64 193  85  98  77 236  87  72  47
2003 196 120  51  27 143  99  56
require(graphics)
plot.ts(dataTimeSeries, xaxt="n", xlab= "Perioda", ylab= "Opazovane
vrednosti", type='l', col='red')
axis(side=1, at=seq(1,40,4), labels=seq(1,10,1))

Thanks in advance for any help!

Have a look at what

  par("usr")

gives to see that your "at" setting makes no sense.

Peter Ehlers

______________________________________________
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