[R] legend mathematical annotation problem

Gavin Simpson gavin.simpson at ucl.ac.uk
Tue Feb 23 00:48:58 CET 2010


On Sat, 2010-02-13 at 13:57 -0500, David Winsemius wrote:
> 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.
> >>
<snip />
> > 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 OP might also like to look at phantom() in ?plotmath to control the
extra spacing required for "blank".

HTH

G

> 
> 
> > 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
> 
> ______________________________________________
> 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.

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list