carol white
2009-Oct-09 21:10 UTC
[R] plot the same types of graphics on the same R graphic device
Hi, How to plot the same types of graphics on the same R graphic device? Suppose that we want to plot a vector y against x (using plot for instance). How is it possible to plot y against x for different values of these two vectors on the same device so that the plots could be compared? Cheers, Carol [[alternative HTML version deleted]]
John Kane
2009-Oct-09 22:01 UTC
[R] plot the same types of graphics on the same R graphic device
?lines ?points Something like : x <- 1:10 y1 <- rnorm(10, 4, 3) y2 <- rnorm(5,5,2) ymax <- max(c(y1,y2)) ymin <- min(c(y1,y2)) plot(x, y1, col='red',ylim = c(ymin,ymax)) lines(y2, col='green') --- On Fri, 10/9/09, carol white <wht_crl at yahoo.com> wrote:> From: carol white <wht_crl at yahoo.com> > Subject: [R] plot the same types of graphics on the same R graphic device > To: r-help at stat.math.ethz.ch > Received: Friday, October 9, 2009, 5:10 PM > Hi, > How to plot the same types of graphics on the same R > graphic device? Suppose that we want to plot a vector y > against x (using plot for instance). How is it possible to > plot y against x for different values of these two vectors > on the same device so that the plots could be compared? > > Cheers, > > Carol > > > > ? ? ? > ??? [[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. >__________________________________________________________________ Looking for the perfect gift? Give the gift of Flickr! http://www.flickr.com/gift/
Sarah Goslee
2009-Oct-09 22:04 UTC
[R] plot the same types of graphics on the same R graphic device
Hi Carol, It isn't at all clear exactly what you are trying to do, but you might want to read the help for either points() and lines() [to put more than one data pair on a single plot], or for par, specifically mfrow and mfcol, or for layout [to put more than one plot on a single device window]. If none of those do it, then try again with a more detailed description of what you are looking for. Sarah On Fri, Oct 9, 2009 at 5:10 PM, carol white <wht_crl at yahoo.com> wrote:> Hi, > How to plot the same types of graphics on the same R graphic device? Suppose that we want to plot a vector y against x (using plot for instance). How is it possible to plot y against x for different values of these two vectors on the same device so that the plots could be compared? > > Cheers, > > Carol > > > >-- Sarah Goslee http://www.functionaldiversity.org