# Re: [R] Time series plot

From: Arun Kumar Saha <arun.kumar.saha_at_gmail.com>
Date: Thu 04 Jan 2007 - 08:48:11 GMT

Thank you very much for your letter. Actually I got partial solution from your suggestion. Still I am fighting with defining a secondary axis. More pecisely, suppose I have following two dataset:

x = c(1:10)
y = x*10

To plot x I can simply write plot(x, type='l'), here the"y-axis" takes value from 1:10. Now I want to plot y on a Secondary "Y-axis" on same graphics window. Secondary y-axis will take value from 1:100 and plot y accordingly, just like Microsoft Excel. Is there any solution?

Thanks and regards,

On 1/4/07, Gabor Grothendieck <ggrothendieck@gmail.com> wrote:
>
> You can use read.zoo in the zoo package to read in the data
> and then see:
>
> https://www.stat.math.ethz.ch/pipermail/r-help/2006-December/122742.html
>
> See ?axis for creating additional axes with classic graphics and
>
> library(lattice)
> ?panel.axis
>
> in lattice graphics. Search the archives for examples.
>
> On 1/4/07, Arun Kumar Saha <arun.kumar.saha@gmail.com> wrote:
> > Dear all R users,
> >
> > Suppose I have a data set like this:
> >
> > date price
> >
> > 1-Jan-02 4.8803747
> > 2-Jan-02 4.8798430
> > 3-Jan-02 4.8840133
> > 4-Jan-02 4.8803747
> > 5-Jan-02 4.8749683
> > 6-Jan-02 4.8754263
> > 7-Jan-02 4.8746628
> > 8-Jan-02 4.8753500
> > 9-Jan-02 4.8882416
> > 10-Jan-02 4.8895217
> > 11-Jan-02 4.8871108
> >
> > I want to get a time series plot of that dataset. But in x-axis I want
> to
> > see the first day, and last day, and other day in between them i.e.
> > 1-Jan-02, 6-Jan-02, and 11-Jan-02 only. Can anyone tell me how to do
> that?
> >
> > My second question is that is there any way to define a secondary axis
> like
> > Microsoft Excel in the same plot window?
> >
> > Thanks and regards,
> > Arun
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>

[[alternative HTML version deleted]]

R-help@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 and provide commented, minimal, self-contained, reproducible code. Received on Thu Jan 04 19:53:59 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 04 Jan 2007 - 18:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.