[R] Help with Time Series Plot‏

Peter Ehlers ehlers at ucalgary.ca
Fri Mar 18 02:51:36 CET 2011


On 2011-03-17 16:37, Axel Urbiz wrote:
>   Dear List,
>
> This is an embarrassing question, but I can seem to make this work…How do I
> change the font size on the xlab and on the numbers shown in the x-axis on
> the time series plot below. The arguments cex.lab and cex.axis do not seem
> to be 'passing' to the plot function.
>
> plot(ts(rnorm(100), start=2004, freq=12),
>        ylab="RQI", xlab="My X lab", col="black", cex.lab=0.1, cex.axis=0.7)

This seems to be a result of the way plot.ts is coded.
It does seem unnecessarily restrictive to me, but there
may be a good reason and it's easy to work around.

If you want both axes/labels to be scaled the same way,
just do:

  op <- par(cex.axis = 0.7, cex.lab = 0.1)
  plot(tsobject)
  par(op)

For more control over the axes, skip labelling with the
plot call and add the axes/labels with axis() and title():

  plot(tsobject, ann=FALSE, axes=FALSE, frame=TRUE)
  axis(2, cex.axis=0.5)
  axis(1, cex.axis=1.2)
  title(xlab="this is X", cex.lab=0.8)

See
?axis
?title

Peter Ehlers

> Thanks,
> Axel.
>
> 	[[alternative HTML version deleted]]
>



More information about the R-help mailing list