Part of the reason I was having difficulty is that I'm trying to add a legend with more than one element:
plot(1,1) obv = 5 txt = "Pop mean" # this works legend("topleft", legend=bquote(.(txt) == .(obv)*degree)) # but this doesn't legend("topleft", legend=c(bquote(.(txt) == .(obv)*degree), "Von Mises distribution")) How can I go about using multiple legend elements with mathematical/latin annotation in both? Tyler On Mon, Dec 27, 2010 at 8:22 PM, Peter Ehlers <ehl...@ucalgary.ca> wrote: > On 2010-12-27 16:51, David Winsemius wrote: > >> >> On Dec 27, 2010, at 6:40 PM, T.D. Rudolph wrote: >> >> >>> I've exceeded the maximum time I am willing to accept for solving >>> simple >>> problems so I thank all in advance for your assistance. >>> >>> I am trying to plot text combined with an object value and a >>> superscript. >>> >>> obv = 5 >>> text = "Population mean =" >>> ss = ^o # degrees >>> >>> Something like this (very naive so you get the idea): >>> expression(text, obv, ss) >>> >>> paste(text, obv) # works ...but of course I either lose the value of >>> obv or >>> the superscript in the translation using expression, and bquote >>> doesn't seem >>> to accept the asterisk before the first element. >>> >> >> I had trouble figuring out your real intent, since you have only been >> describing what didn't work but see if this his halfway there: >> >> plot(1,1) >> obv = 5 >> text = "Population mean =" # you should really avoid using function >> names for variables! >> text(.8,.8, bquote(.(text)~.(obv)^o) ) >> >> The ^o seems a bit of a dodge but it looks ok so if you're happy, go >> > > Instead of ^o, use the word 'degree' (see ?plotmath) > > text(.8,.8, bquote(.(text)~.(obv)*degree) ) > > and, personally, I would let R handle the '=' sign: > > txt <- "Pop mean" > text(1, 1.1, bquote(.(txt) == .(obv)*degree)) > > Peter Ehlers > > with it. >> >>> >>> I am a little bungled by the varying syntax used for bquote and all >>> the >>> rest; sometimes R seems more complicated than it needs to be for a >>> relatively simple problem (and for me this is one of those cases!)... >>> >>> Tyler >>> -- >>> >> >> >> David Winsemius, MD >> West Hartford, CT >> >> ______________________________________________ >> R-help@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. >> > > [[alternative HTML version deleted]] ______________________________________________ R-help@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.