[R] Making legend() look like my plot()

Dan Bolser dmb at mrc-dunn.cam.ac.uk
Thu Nov 25 15:01:54 CET 2004


I am using code like the following to create as simple plot...


I want to add a legend which shows lines looking exactly like those used
in my plot, i.e. a thin black line with gaps taken up by circles (the
default for type='b', and a thick dashed red line with no pch at all).

I have two problems, 

1) making the pch on the first like look like type = 'b' (gaps around pch)
2) surpressing a pch on for the second line

Any help with these two problems would be greatly appreciated.

Any archive of plots and code to browse which could help me visually find
what I want and then copy the code?

An online user contributable database of 'graphics in R' would be

How come some smart people dont just let me do something like


to add a legend to the current plot for all the relevant points and lines
which have been added so far?

More information about the R-help mailing list