[R] Legend - revisited

Martin Maechler maechler at stat.math.ethz.ch
Wed Apr 28 08:57:25 CEST 2004

Thank you, Petr,

>>>>> "Petr" == Petr Pikal <petr.pikal at precheza.cz>
>>>>>     on Tue, 27 Apr 2004 18:13:16 +0200 writes:

    Petr> Hallo Monica I tried to do the same task recently and
    Petr> the only solution I was able to come with was to hack
    Petr> legend() function. You can find it in graphics library
    Petr> (R1.9.0).

    Petr> I just added

    Petr> cex.pt = cex,

    Petr> in the definition

    Petr> and

    Petr> cex=cex.pt,

    Petr> instead cex=cex,

    Petr> into draw points part of the function.

Since this seems really something you'd want (cex of text differing
from cex of points), I'd propose to use

  pt.cex  instead of  cex.pt,

for naming consistency, because we already have 'pt.bg'
(together with 'bg') as argument name.

    Petr> Than I can when calling legend to leave default cex or
    Petr> to use different setting for legend text ("cex") and
    Petr> points ("cex.pt" ).

    Petr> BTW cex is vectorised so cex=c(1,1,2,3) gives you
    Petr> different cex setting for 4 different legend items.

    Petr> I copied the modified function into my library and now

you certainly mean "package", not "library" ... ;-|

    Petr> I wait if some other function starts to complain about
    Petr> my modifications :-).

Hardly possible -- since this is a feature that cannot break
For this same reason, I'm considering adding this mini-extension
already for R-patched (probably to be 1.9.1).


More information about the R-help mailing list