Re: [R] legend with filled boxes AND lines

From: Martin Maechler <>
Date: Tue 04 Jul 2006 - 02:41:54 EST

Did you try legend(......, lty=..., fill=..., merge = TRUE) ?

In an example I just tried, this allowed to give filled boxes *and* lines.

Please give a reproducible example of what you did -- maybe by modifying one of the many example(legend) examples.

Martin Maechler, ETH Zurich

>>>>> "florian" == florian koller <>
>>>>> on Mon, 3 Jul 2006 13:40:33 +0200 writes:

    florian> Dear all,

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

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

    florian> Thanks,
    florian> Florian

    florian> ______________________
    florian> Florian Koller
    florian> GfK Fernsehforschung GmbH
    florian> Research Consulting & Development
    florian> Nordwestring 101
    florian> D-90319 Nürnberg
    florian> Fon  +49 (0)911 395-3554

    florian> Fax +49 (0)911 395-4130
    florian> /
    florian> _________________________

    florian> Diese E-Mail (ggf. nebst Anhang) enthält vertrauliche und/oder rechtlich
    florian> geschützte Informationen. Wenn Sie nicht der richtige Adressat sind, oder
    florian> diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
    florian> Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die     florian> unbefugte Weitergabe dieser Mail ist nicht gestattet.
    florian> This e-mail (and any attachment/s) contains confidential and/or privileged
    florian> information. If you are not the intended recipient (or have received this
    florian> e-mail in error) please notify the sender immediately and destroy this
    florian> e-mail. Any unauthorised copying, disclosure or distribution of the
    florian> material in this e-mail is strictly forbidden.

    florian> ______________________________________________
    florian> mailing list
    florian>     florian> PLEASE do read the posting guide! mailing list PLEASE do read the posting guide! Received on Tue Jul 04 02:45:05 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 04 Jul 2006 - 04:14:41 EST.

Mailing list information is available at Please read the posting guide before posting to the list.