Re: [R] Legend

From: Frede Aakmann Tøgersen <FredeA.Togersen_at_agrsci.dk>
Date: Wed, 26 Sep 2007 11:49:13 +0200


You can use bquote (see ?bquote or the example in ?plotmath using bquote).

Here you go,

pvalue <- 0.3
legend("bottom", fill=c("red","blue"), legend=c(bquote(p==.(pvalue)), expression(p==0.50)), bty="n")

Med venlig hilsen
Frede Aakmann Tøgersen    

> -----Oprindelig meddelelse-----
> Fra: r-help-bounces_at_r-project.org
> [mailto:r-help-bounces_at_r-project.org] På vegne af stat stat
> Sendt: 26. september 2007 00:13
> Til: r-help_at_stat.math.ethz.ch
> Emne: [R] Legend
>
> I have following syntax for putting a legend :
>
> legend("bottom", fill=c("red","blue"),
> legend=expression(p==0.30, p==0.50), bty="n")
>
> However what I want is that : the value "0.30" should be a
> value of a variable instead of a constant, so that I can put
> the name of this variable and in legend it's value will be
> displayed. Can anyone tell me how to do that?
>
> Regards,
>
>
> thanks in advance
>
> ---------------------------------
> Why delete messages? Unlimited storage is just a click away.
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 26 Sep 2007 - 09:58:23 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 26 Sep 2007 - 12:35:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.