[Rd] legend()s text color

Martin Maechler maechler at stat.math.ethz.ch
Wed Feb 25 14:50:50 MET 2004


{moved from R-help to R-devel}

>>>>> "UweL" == Uwe Ligges <ligges at statistik.uni-dortmund.de>
>>>>>     on Tue, 24 Feb 2004 19:05:46 +0100 writes:

    UweL> Sebastien Durand wrote:
    >> Hi,
    >> 
    >> Is there a way to change the color of the text inside a legend, let say 
    >> I would like to use a black background in my legend, how can I get the 
    >> text to show up, it is black!!!
    >> So for example how could I change it to white...?
    >> 
    >> Sebastien


    UweL> By setting par(fg = "white"):

    UweL> plot(1:10)
    UweL> par(fg="white")
    UweL> legend(2,2, col="white", legend="A", bg="black")

or  par(col = "white"),
as Marc has suggested.

legend()'s source code makes it very straightforward to add an
argument 'text.col' for this purpose, and I have already done so
in my development version.
The question is really if the default should be
   text.col = par("col")
or text.col = par("fg")

I'd currently tend for  par("col") , but the tendency is weak.

Martin



More information about the R-devel mailing list