Hi, I have two XY datasets (e.g., longitude and concentrations) who share the same X scale. How can I make a simple scatterplot which will combine them both with different colors for the two Y groups? (plot and xyplot solutions are fine with me). Thanks in advance. Cheers -- View this message in context: http://r.789695.n4.nabble.com/Scatterplot-question-tp2341456p2341456.html Sent from the R help mailing list archive at Nabble.com.
On Aug 27, 2010, at 2:16 PM, ashz wrote:> > Hi, > > I have two XY datasets (e.g., longitude and concentrations) who > share the > same X scale. How can I make a simple scatterplot which will combine > them > both with different colors for the two Y groups? (plot and xyplot > solutions > are fine with me). >Base graphics: ?points Lattice: ?panel.points ############> and provide commented, minimal, self-contained, reproducible code.############ -- David Winsemius, MD West Hartford, CT
Is this what you want? x=rnorm(10) y1=0.5*rnorm(10)+0.5*rexp(10) y2=0.5*rnorm(10)+0.5*runif(10) xlimit=range(x) ylimit=range(c(y1,y2)) plot(x,y1,pch="1",col=2,xlim=xlimit, ylim=ylimit, ylab="Y", xlab="X", cex=0.7) points(x,y2,pch="2", col=4,cex=0.7) -- View this message in context: http://r.789695.n4.nabble.com/Scatterplot-question-tp2341456p2341780.html Sent from the R help mailing list archive at Nabble.com.