From maechler at stat.math.ethz.ch  Thu Feb 26 09:43:20 2004
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Thu Feb 26 09:43:47 2004
Subject: [Rd] Re: legend()s text color
In-Reply-To: <403D4293.1010802@stat.auckland.ac.nz>
References: <a06020410bc612f903765@[192.168.2.3]>
	<403B927A.3000909@statistik.uni-dortmund.de>
	<16444.43066.981715.541826@gargle.gargle.HOWL>
	<403CAADC.3070405@statistik.uni-dortmund.de>
	<1077720399.12496.40.camel@localhost.localdomain>
	<403D4293.1010802@stat.auckland.ac.nz>
Message-ID: <16445.45480.950322.67841@gargle.gargle.HOWL>

>>>>> "Paul" == Paul Murrell <p.murrell@auckland.ac.nz>
>>>>>     on Thu, 26 Feb 2004 13:49:23 +1300 writes:

    Paul> Hi
    Paul> Marc Schwartz wrote:
    >> On Wed, 2004-02-25 at 08:02, Uwe Ligges wrote:
    >> 
    >>> Martin Maechler wrote:
    >>> 
    >>> 
    >>>> {moved from R-help to R-devel}
    >>>> 
    >>>> 
    >>>> 
    >>>>>>>>> "UweL" == Uwe Ligges <ligges@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.
    >>>> 
    >>> 
    >>> I agree, I would expect the lines around the legend's box in par("fg"), 
    >>> but the font in par("col"). And indeed, that's already the case if both 
    >>> values have been set in par().
    >>> 
    >>> Uwe
    >> 
    >> 
    >> 
    >> Martin,
    >> 
    >> Thanks for taking this on. 
    >> 
    >> I'll throw in my vote and support the text.col = par("col") approach.


    Paul> There is little consistency to the interpretation of these parameters 
    Paul> across different functions, but my preference would be to use "col"

    Paul> Paul

Thank you Paul (and Marc and Uwe).

      legend(...., text.col = par("col"))

is now committed to R-devel.

Martin


[Rd] Re: legend()s text color
Martin Maechler