[R] grid.legend - lines

Daniel Mastropietro mastropi at uwalumni.com
Tue Sep 17 16:07:48 CEST 2002


Suppose you want to put 3 different point legends for points and one legend 
for a line, then a solution that I have been using is the following:

legend(locator(1) , legend=c("Point 1" , "Point 2" , "Point 3" , "Line 1") 
, pch=c(rep(1,3) , -1) , lty=c(rep(0,3) , 1))

The '-1' in the pch option is to avoid having a point in the one line 
legend, and the rep(0,3) in the lty option is to avoid having a line in the 
3 point legends.

Daniel Mastropietro

At 10:13 AM 17/9/2002 +0200, Morten Sickel wrote:
>I am testing out the grid-plots, but get into a problem making a legend. I
>have a line plot and some points, following the model in
>grid.plot.and.legend() i manage to get the points correctly in the legend,
>but what do I do with the line? (Of cource, I can just draw a line at the
>right location on the plot, but I would prefer to use legend)
>
>Morten
>
>--
>Morten Sickel
>Norwegian Radiation Protection Authority

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list