[R] How do I edit the x-axis on a time series plot?

Austin, Matt maustin at amgen.com
Wed Dec 21 17:39:18 CET 2005


Phil,

Does the following do what you want?

plot(RecfS,
     ylab = 'Temperature (deg C)',
     xlab = 'Year',
     main = 'Average air temperature (deg C) at Recife, Brazil, in
successive months from 1953 to 1962',
     adj = 0.5,
     axes=FALSE)

axis(1, at=1952:1962, label=paste("Jan", 52:62), las=2)
axis(2)
box()

--Matt

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Philip Turk
Sent: Tuesday, December 20, 2005 8:37 PM
To: r-help at stat.math.ethz.ch
Subject: [R] How do I edit the x-axis on a time series plot?


I am merely trying to reproduce Figure 1.2 of Chris Chatfield's 6th 
edition of his The Analysis of Time Series: An Introduction (page 2). 
The S-PLUS code is on pages 305-306. I am almost there but I am having a 
heck of a time trying to modify and change the x-axis per the book. The 
book shows the x-axis with 10 tick marks, correctly positioned, and 
labeled "Jan 53", ..., "Jan 62". I have not provided the data for the 
sake of brevity although it is readily available at 
http://www.bath.ac.uk/~mascc/Recife.TS

Can anyone help?

recife <- as.vector(t(recife))<>
RecfS <- ts(recife, start = c(1953,1), frequency = 12) <>
plot(RecfS, ylab = “Temperature (deg C)”, xlab = “Year”, main = “Average 
air temperature (deg C) at Recife, Brazil, in successive months from 
1953 to 1962”, adj = 0.5)

Thanks,

Philip Turk
<>

______________________________________________
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