Hi, Trying to print out two vectors of data in a plot. Both are actual time series but I've been unable to plot both in one graph. Some examples available use use matrix() or ts() as an intermediate way to build an object that can be plotted but I've had no luck. Can someone point me to an example or cut and paste one I can look at? I'd like to be able to plot them in different colours as I've done with the ts.plot function with output from STL. Thanks. Ed
plotting question
6 messages · Ed Wang, Bert Gunter, Gabor Grothendieck +2 more
?lines ?points An Introduction to R (and numerous other books on R) explains this. Have you read it? -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA "The business of the statistician is to catalyze the scientific learning process." - George E. P. Box
-----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Ed Wang Sent: Monday, December 05, 2005 1:03 PM To: r-help at stat.math.ethz.ch Cc: eymw at hotmail.com Subject: Re: [R] plotting question Hi, Trying to print out two vectors of data in a plot. Both are actual time series but I've been unable to plot both in one graph. Some examples available use use matrix() or ts() as an intermediate way to build an object that can be plotted but I've had no luck. Can someone point me to an example or cut and paste one I can look at? I'd like to be able to plot them in different colours as I've done with the ts.plot function with output from STL. Thanks. Ed
______________________________________________ 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
Yes, I have gone through the manual. My best reference for plotting has
been examples either through the list archive or searches on the internet.
Nothing in the introductory manual could get me to what I have been
able to do so far, but that is limited to plotting componenets of the time
series returned from an STL call.
This is why I am asking for example or references to examples from anyone
who would be willing to share them. For some of us not very familiar with
S+, etc. the documentation with R is not enough. While I can plot two
time series one above another using the mfrow() function I'd prefer to
put two time series in one plot in different colours and using two different
symbols, which I cannot do using calls to plot().
Thanks.
"A man is not old until regrets take the place of dreams."
Actor John Barrymore
From: Berton Gunter <gunter.berton at gene.com>
To: "'Ed Wang'" <eymw at hotmail.com>, <r-help at stat.math.ethz.ch>
Subject: RE: [R] plotting question
Date: Mon, 5 Dec 2005 14:12:47 -0800
?lines ?points
An Introduction to R (and numerous other books on R) explains this. Have you
read it?
-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
"The business of the statistician is to catalyze the scientific learning
process." - George E. P. Box
Try
RSiteSearch("multiple plots")
and look through the second thread. Note that once you
know the command you need from the above then, e.g.
example(ts.plot)
gives an example.
On 12/5/05, Ed Wang <eymw at hotmail.com> wrote:
Yes, I have gone through the manual. My best reference for plotting has
been examples either through the list archive or searches on the internet.
Nothing in the introductory manual could get me to what I have been
able to do so far, but that is limited to plotting componenets of the time
series returned from an STL call.
This is why I am asking for example or references to examples from anyone
who would be willing to share them. For some of us not very familiar with
S+, etc. the documentation with R is not enough. While I can plot two
time series one above another using the mfrow() function I'd prefer to
put two time series in one plot in different colours and using two different
symbols, which I cannot do using calls to plot().
Thanks.
"A man is not old until regrets take the place of dreams."
Actor John Barrymore
From: Berton Gunter <gunter.berton at gene.com>
To: "'Ed Wang'" <eymw at hotmail.com>, <r-help at stat.math.ethz.ch>
Subject: RE: [R] plotting question
Date: Mon, 5 Dec 2005 14:12:47 -0800
?lines ?points
An Introduction to R (and numerous other books on R) explains this. Have you
read it?
-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
"The business of the statistician is to catalyze the scientific learning
process." - George E. P. Box
______________________________________________ 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
Ed Wang wrote:
Yes, I have gone through the manual. My best reference for plotting has been examples either through the list archive or searches on the internet. Nothing in the introductory manual could get me to what I have been able to do so far, but that is limited to plotting componenets of the time series returned from an STL call. This is why I am asking for example or references to examples from anyone who would be willing to share them. For some of us not very familiar with S+, etc. the documentation with R is not enough. While I can plot two time series one above another using the mfrow() function I'd prefer to put two time series in one plot in different colours and using two different symbols, which I cannot do using calls to plot().
What about making the two time series into an mts (multiple time series)
object, with
my.mts <- cbind(ts.1, ts.2) or maybe
my.ts <- ts.union(ts.1, ts.2) This latest command does not assume a
commom time base. Then
plot(my.ts,plot.type="single", col=c("red", "blue"))
Kjetil
Thanks.
"A man is not old until regrets take the place of dreams."
Actor John Barrymore
From: Berton Gunter <gunter.berton at gene.com>
To: "'Ed Wang'" <eymw at hotmail.com>, <r-help at stat.math.ethz.ch>
Subject: RE: [R] plotting question
Date: Mon, 5 Dec 2005 14:12:47 -0800
?lines ?points
An Introduction to R (and numerous other books on R) explains this. Have you
read it?
-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
"The business of the statistician is to catalyze the scientific learning
process." - George E. P. Box
______________________________________________ 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
Ed, I am no expert at R but if you follow the tips from the previous poster (eg type ?lines) and go to the very bottom of the help page there is an example that plots a line over some points. cheers
Ed Wang wrote:
Yes, I have gone through the manual. My best reference for plotting has
been examples either through the list archive or searches on the internet.
Nothing in the introductory manual could get me to what I have been
able to do so far, but that is limited to plotting componenets of the time
series returned from an STL call.
This is why I am asking for example or references to examples from anyone
who would be willing to share them. For some of us not very familiar with
S+, etc. the documentation with R is not enough. While I can plot two
time series one above another using the mfrow() function I'd prefer to
put two time series in one plot in different colours and using two different
symbols, which I cannot do using calls to plot().
Thanks.
"A man is not old until regrets take the place of dreams."
Actor John Barrymore
From: Berton Gunter <gunter.berton at gene.com>
To: "'Ed Wang'" <eymw at hotmail.com>, <r-help at stat.math.ethz.ch>
Subject: RE: [R] plotting question
Date: Mon, 5 Dec 2005 14:12:47 -0800
?lines ?points
An Introduction to R (and numerous other books on R) explains this. Have you
read it?
-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
"The business of the statistician is to catalyze the scientific learning
process." - George E. P. Box
______________________________________________ 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