[R] Odp: 2 plots with different scales in the same graphical window

Greg Snow Greg.Snow at imail.org
Thu Dec 9 18:32:18 CET 2010


Just be sure to read the note on the help page for twoord.plot, then reread it, then consider alternatives (including the one mentioned in the note), then if you still want to do this, follow the advice in the note.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Petr PIKAL
> Sent: Thursday, December 09, 2010 8:43 AM
> To: Rafael Moral
> Cc: r-help
> Subject: [R] Odp: 2 plots with different scales in the same graphical
> window
> 
> Hi
> 
> r-help-bounces at r-project.org napsal dne 09.12.2010 16:25:06:
> 
> > Dear useRs,
> > I have two sets of data that I would like to plot in the same window,
> but their
> > ranges are really different, e.g.
> >
> > a <- c(0.2, 0.5, 0.8, 0.3, 0.4, 0.5, 0.2, 0.2, 0.3)
> > b <- c(100, 2000, 800, 200, 100, 50, 4, 2, 0)
> >
> > If I do
> > plot(a, ty='l'); points(b, ty='l')
> > I won't be able to see sequence b.
> >
> > However, if I do
> > plot(b, ty='l'); points(a, ty='l')
> > I won't be able to see the patterns in sequence a.
> >
> > So is  there a way of plotting sequence a and b without applying log
> or
> > anything, but sequence a would be correspondent to the left y-axis
> and
> sequence
> > b correspondent to the right y-axis?
> 
> See twoord.plot from plotrix.
> 
> Or search archuves for a function plot.yy (I posted it few years ago).
> 
> Regards
> Petr
> 
> 
> >
> > Thanks in advance,
> > Best,
> > Rafael.
> >
> >
> >
> >    [[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.
> 
> ______________________________________________
> 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