[R] fill prob. in legend

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Feb 24 19:34:03 CET 2003


Jerome Asselin wrote:
> 
> I think this does what you want...
> 
> Jerome
> 
> plot(0,0)
> legend(0,0,c("blah","blahblah","blahblahblah","blah..."),
> pch=c(21,21,22,22),
> col=c("green","red","blue","blue"),
> pt.bg=c("white","white","yellow","orange"),cex=2)

I don't think so, because Jeremy Butler asked for *lines*.
Unfortunately, the my answer won't be much more helpful (see below).


> On Sunday 23 February 2003 17:29, Jeremy Z Butler wrote:

> > Hi,
> > I'm trying to construct a legend which has four lines of text and
> > associated symbols. The first two symbols need to be normal lines which
> > vary only in colour. The second two symbols should have filled boxes. How
> > do I suppress the fill boxes in the first two lines?
> > J.

Well, you cannot, AFAIK.
You have to construct such a special legend using either two tricky
calls to legend, or add the elements with low level functions like
text() and friends to the plot.
I think a contribution of an improvement of legend() that solves your
problem is welcome.

Uwe Ligges




More information about the R-help mailing list