[R] Plotting 2 Lines on the Same Chart

Petr PIKAL petr.pikal at precheza.cz
Mon Nov 1 11:09:28 CET 2010


Hi

r-help-bounces at r-project.org napsal dne 29.10.2010 20:30:47:

> Thanks.  1 more question.
> 
> When I use
> 
> Plot(series1)
> lines(series2)

1       use plot(series1)
2       read help page for plot.default if you are plotting simple 
scatterplot
3       pay attention to xlim and ylim parameters for plot formating
4       when you read help page you could also go through other options

plot(series1, ylim=range(c(series1, series2)))

Regards
Petr

> 
> The graph will use the y axis scaling for series 1 so some of series 2 
is
> cut off.  How do I control the y axis scaling?
> 
> Thanks,
> 
> Jason
> 
> On Fri, Oct 29, 2010 at 2:10 PM, Gabor Grothendieck 
<ggrothendieck at gmail.com
> > wrote:
> 
> > On Fri, Oct 29, 2010 at 1:41 PM, Jason Kwok <jaykwok at gmail.com> wrote:
> > > How do I plot two time series plots on the same chart?
> > >
> >
> > Try this:
> >
> > example(plot.ts)
> > example(ts.plot)
> >
> > library(zoo)
> > example(plot.zoo)
> > library(lattice)
> > example(xyplot.zoo)
> >
> > --
> > Statistics & Software Consulting
> > GKX Group, GKX Associates Inc.
> > tel: 1-877-GKX-GROUP
> > email: ggrothendieck at gmail.com
> >
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org 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.



More information about the R-help mailing list