[R] plotting in R

Jason Turner jasont at indigoindustrial.co.nz
Mon May 3 03:55:22 CEST 2004


Karla Meurk wrote:

> Hi there, I have 2 questions which I cannot find answers for in Dalgaard 
> or the helpfiles currently available.
> 
> (1) I wish to plot 3 ecdf plots on one graph.  Is there any way of 
> holding a figure to plot all on the same plot.  I can't get an ecdf for 
> any plot command other than "plot" or "ecdf.plot" so using lower level 
> command is no good, have also tried x11().

Not familiar with plotting ecdf objects, but the following might be 
helpful...

a)  str() to find the structure of the ecdf object (if the help page for 
ecdf's "Value" section isn't clear enough), then use "lines" to put the 
lines on.

b) par(new=TRUE), before replotting, then plot(..., xaxt="n", yaxt="n") 
to prevent re-drawing the axes.

> (2) If I have three curves on a plot how can I label each curve so the 
> label sits directly above the curve?

?text.  To select where the text goes, you can work out the 
co-ordinates, or use mouse clicks, as in...

text(locator(1),"Curve 1")
text(locator(1),"Curve 2")
...

and click at the points you want the text.

Cheers

Jason




More information about the R-help mailing list