[R] legend mathematical annotation problem

David Winsemius dwinsemius at comcast.net
Sat Feb 13 19:57:36 CET 2010


On Feb 13, 2010, at 1:45 PM, David Winsemius wrote:

>
> On Feb 13, 2010, at 1:13 PM, Mark Heckmann wrote:
>
>> 1) I need to plot a legend containing the mathematical symbol  
>> greater-than-or-equal sign.
>> And I want the text to start with that symbol.
>>
>> plot(110, 0.8)
>> categories <- expression(blank >= 85, 84.9 - 80, 79.9 - 75, 74.9 -  
>> 70, 69.9 - 65, 64.9 - 60, blank< 60)
>> legend(110, 0.8, categories, lty=1:7, lwd=3, col=1, merge=TRUE)
>>
>> What I want is just ">=85" to be printed, but without something  
>> (here "blank") in front it is no correct expression.
>>
>> 2) Also I want German type decimals, that is a comma instead of a  
>> point.
>> But the problem is, that the comma is used as argument separator in  
>> expression.
>>
>> plot(110, 0.8)
>> categories <- expression(blank >= 85, 84,9 - 80, 79,9 - 75, 74,9 -  
>> 70, 69,9 - 65, 64,9 - 60, blank< 60)
>> legend(110, 0.8, categories, lty=1:7, lwd=3, col=1, merge=TRUE)
>
> Try:
> > plot(110, 0.8)
> > categories <-legend(110, 0.8, c( expression("     ">= " 85"),  
> "84,9 - 80", "79,9 - 75", "74,9 - 70", "69,9 - 65", "64,9 - 60",  
> expression("    "<" 60"))
> + , lty=1:7, lwd=3, col=1, merge=TRUE)
>
That worked because of side-effects. Better might be:

categories <- c( expression("     " >=  " 85"), "84,9 - 80", "79,9 -  
75", "74,9 - 70", "69,9 - 65", "64,9 - 60", expression("    " < " 60"))

plot(110, 0.8)
legend(110, 0.8, categories, lty=1:7, lwd=3, col=1, merge=TRUE)


> The commas inside quotes do not cause problems.
>
>>
>> This does obviously not work. Any ideas?
>>
>> Thanks,
>> Mark
>> –––––––––––––––––––––––––––––––––––––––
>> Mark Heckmann
>> Dipl. Wirt.-Ing. cand. Psych.
>> Vorstraße 93 B01
>> 28359 Bremen
>> Blog: www.markheckmann.de
>> R-Blog: http://ryouready.wordpress.com
>>
>> ______________________________________________
>> 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.
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
> ______________________________________________
> 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list