[R] show overstruck in plot legend

Marc Schwartz marc_schwartz at comcast.net
Sat Jan 19 17:21:11 CET 2008


tom soyer wrote:
> Hi,
> 
> I have a plot with type="o", or overstruck. Now I am trying to add the
> legend, but I couldn't figure out how to show the overstruck type in the
> legend. It seems that the legend only allows one to set lty. Does anyone
> know how to show overstruck in the legend?
> 
> Thanks!

Tom,

Try this:

  plot(1:10, type = "o")
  legend("topleft", legend = "Test", pch = 1, lty = 1)

Essentially indicate both the point symbol and line type for the legend.

HTH,

Marc Schwartz



More information about the R-help mailing list