Hi Well, I think the title says it all!? I've looked through the documentation but I can't find a way of doing this.? The situation is that I have 4 series, say a, b, c and d.? Series a and c are plotted on the lh y axis, series b and d are plotted on the rh (secondary) y axis.? I've worked out how to do this. However, I need to plot series a and b a points (symbols only, no line), whislt c and d need plotting as lines (with no symbols).? What is the easiest way to do this in xyplot?? Or should?I be using something else? Thanks! Paul
Dylan Beaudette
2009-Sep-04 15:34 UTC
[R] Creating mixed line and point graphs with xyplot
Here is an example: http://casoilresource.lawr.ucdavis.edu/drupal/node/510 make.groups() is your friend. Cheers, Dylan On Fri, Sep 4, 2009 at 8:28 AM, Paul Sweeting<mail at paulsweeting.co.uk> wrote:> Hi > > Well, I think the title says it all!? I've looked through the documentation but I can't find a way of doing this.? The situation is that I have 4 series, say a, b, c and d.? Series a and c are plotted on the lh y axis, series b and d are plotted on the rh (secondary) y axis.? I've worked out how to do this. > > However, I need to plot series a and b a points (symbols only, no line), whislt c and d need plotting as lines (with no symbols).? What is the easiest way to do this in xyplot?? Or should?I be using something else? > > Thanks! > > Paul > > ______________________________________________ > 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. >
Gabor Grothendieck
2009-Sep-04 16:41 UTC
[R] Creating mixed line and point graphs with xyplot
If you represent your series as zoo series then you can do this: library(zoo) z <- zoo(cbind(a = 1:3, b = 4:6, c = 3:1, d = 6:4)) xyplot(z, screen = 1, type = c("p", "p", "l", "l")) See the three vignettes that come with zoo and also see ?xyplot.zoo If you omit screen = 1 then the 4 will be on separate graphs. On Fri, Sep 4, 2009 at 11:28 AM, Paul Sweeting<mail at paulsweeting.co.uk> wrote:> Hi > > Well, I think the title says it all!? I've looked through the documentation but I can't find a way of doing this.? The situation is that I have 4 series, say a, b, c and d.? Series a and c are plotted on the lh y axis, series b and d are plotted on the rh (secondary) y axis.? I've worked out how to do this. > > However, I need to plot series a and b a points (symbols only, no line), whislt c and d need plotting as lines (with no symbols).? What is the easiest way to do this in xyplot?? Or should?I be using something else? > > Thanks! > > Paul > > ______________________________________________ > 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. >
Deepayan Sarkar
2009-Sep-04 18:39 UTC
[R] Creating mixed line and point graphs with xyplot
On Fri, Sep 4, 2009 at 8:28 AM, Paul Sweeting<mail at paulsweeting.co.uk> wrote:> Hi > > Well, I think the title says it all!? I've looked through the documentation but I can't find a way of doing this.? The situation is that I have 4 series, say a, b, c and d.? Series a and c are plotted on the lh y axis, series b and d are plotted on the rh (secondary) y axis.? I've worked out how to do this. > > However, I need to plot series a and b a points (symbols only, no line), whislt c and d need plotting as lines (with no symbols).? What is the easiest way to do this in xyplot?? Or should?I be using something else? >It's hard to be specific without a concrete example, but something like the following may work: xyplot(..., type = c("p", "p", "l", "l"), distribute.type = TRUE) -Deepayan
I would use the base plot routine plot(x,c, type='l', ylim=range(a,c)) points(x,a) park(new=TRUE) plot(x,d,type='l', ylim=range(b,d), axes=FALSE,ylab='', xlab='') pints(x,b) axis(4) On Fri, Sep 4, 2009 at 11:28 AM, Paul Sweeting<mail at paulsweeting.co.uk> wrote:> Hi > > Well, I think the title says it all!? I've looked through the documentation but I can't find a way of doing this.? The situation is that I have 4 series, say a, b, c and d.? Series a and c are plotted on the lh y axis, series b and d are plotted on the rh (secondary) y axis.? I've worked out how to do this. > > However, I need to plot series a and b a points (symbols only, no line), whislt c and d need plotting as lines (with no symbols).? What is the easiest way to do this in xyplot?? Or should?I be using something else? > > Thanks! > > Paul > > ______________________________________________ > 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?