[R] Legend - revisited
Petr Pikal
petr.pikal at precheza.cz
Tue Apr 27 18:13:16 CEST 2004
Hallo Monica
I tried to do the same task recently and the only solution I was
able to come with was to hack legend() function. You can find it
in graphics library (R1.9.0).
I just added
cex.pt = cex,
in the definition
and
cex=cex.pt,
instead cex=cex,
into draw points part of the function.
Than I can when calling legend to leave default cex or to use
different setting for legend text ("cex") and points ("cex.pt" ).
BTW cex is vectorised so cex=c(1,1,2,3) gives you different cex
setting for 4 different legend items.
I copied the modified function into my library and now I wait if
some other function starts to complain about my modifications :-).
HTH.
Cheers
Petr
On 27 Apr 2004 at 11:31, Monica Palaseanu-Lovejoy wrote:
> Hi,
>
> I am trying to put a legend to a graph of quintiles. The points for
> quintiles are colored differently and the points themselves have
> different sizes. I was able to match everything but the points sizes.
> If i am using cex parameter it changes both the points and the text
> dimensions ....
>
> I am not sore if i was clear, but what i want is different sizes for
> the points but same size for the text in the legend. Here it is the
> command i am using:
>
> legend(438000, 367000, c("1st quintile", "2nd quintile", "3rd
> quintile", 4th quintile , 5th quintile"), pch = c(21,21,21,21,21),
> pt.bg = c( blue , green , yellow , brown , red ), cex=1.2)
>
> Any suggestion will be greatly appreciated.
>
> Monica
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
Petr Pikal
petr.pikal at precheza.cz
More information about the R-help
mailing list