[R] how to draw an overlaid plot for multiple curves using different symbols for each curve?

Andrew Robinson andrewr at uidaho.edu
Mon Sep 20 00:27:28 CEST 2004


Sun,

here are some options.  You can use points() to add new points to a
plot, or you can use par(new=T) to plot a new graph in a previously-
used device.  So, in code the two options would look like:

plot(x1, y1, pch=1)
points(x2, y2, pch=2)

(this preserves the original axes) or

plot(x1, y1, pch=1)
par(new=T)
plot(x2, y2, pch=2)

for which the new plot will have new axes etc., so if you want to
perserve the axis characteristics then you need to do so seperately.

I did not include details about subsetting.  I hope that this helps.

Andrew

On Sun, Sep 19, 2004 at 05:02:21PM -0500, Sun wrote:
> Hello, Rusers:
> 
> I have a question to ask for your help. The data has three columns: a, b and
> c.
> 
> We need to draw an overlaid plot of curves of "a" versus "b" for different
> c. That is, draw many curves in one plot and each curve uses a different
> symbol.
> 
> Does R have such functions? I have searched for a while. But seems not. I am
> new to R. Your help is highly appreciated.
> 
> Many thanks. Looking forward to your response,
> 
> Sun
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Andrew Robinson                      Ph: 208 885 7115
Department of Forest Resources       Fa: 208 885 6226
University of Idaho                  E : andrewr at uidaho.edu
PO Box 441133                        W : http://www.uidaho.edu/~andrewr
Moscow ID 83843                      Or: http://www.biometrics.uidaho.edu
No statement above necessarily represents my employer's opinion.




More information about the R-help mailing list