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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Philip Turk
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
<>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: How do I edit the x-axis on a time series plot?

Austin, Matt
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: [hidden email]
[mailto:[hidden email]]On Behalf Of Philip Turk
Sent: Tuesday, December 20, 2005 8:37 PM
To: [hidden email]
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
<>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html