[R] legend with filled boxes AND lines

florian.koller at gfk.com florian.koller at gfk.com
Mon Jul 3 13:40:33 CEST 2006

Dear all,

Is there a straightforward way to create a legend box that has both filled
boxes and lines?
So far I have built around this problem by creating two legends (with bty =
"n") and manually drawing a box around both (but this is cumbersome,
because I have to check upon the y coordinates of the legends every time).

If I do something like > legend( ...,c("X1","X2", "mean"), fill = c("red",
"blue", 0), lty = (0,0,2)) < , I cannot get rid of the unfilled box or
change the color of the fill box border (from its default color "black"),
and I end up with two filled boxes and an empty, black-lined box plus the
line as a legend for the third argument "mean". This trick therefore only
works if I define "black" as the bg color for the complete legend box
(because it masks the empty  box from the fill argument). So, if there is a
command to modify the color of the fill box border line (not the legend box
border line), this would help me, too (still not ideal, though...).


Florian Koller
GfK Fernsehforschung GmbH
Research Consulting & Development
Nordwestring 101
D-90319 Nürnberg
Fon  +49 (0)911 395-3554
Fax  +49 (0)911 395-4130
www.gfk.de / www.gfk.com


Diese E-Mail (ggf. nebst Anhang) enthält vertrauliche und/oder rechtlich
geschützte Informationen. Wenn Sie nicht der richtige Adressat sind, oder
diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die
unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail (and any attachment/s) contains confidential and/or privileged
information. If you are not the intended recipient (or have received this
e-mail in error) please notify the sender immediately and destroy this
e-mail. Any unauthorised copying, disclosure or distribution of the
material in this e-mail is strictly forbidden.

More information about the R-help mailing list