I'd like to put a degree symbol in the title of a plot. Something like:
plot(1,main=expression("Data at " * 45 * degree * " North"))
That works fine, but I like the 45 to be the value of a variable, instead of a
constant, an in:
lat <- 45
plot(1,main=expression("Data at " * lat * degree * " North"))
But this doesn't work of course, the graph title is "Data at lat° North". If
I try to paste expressions and strings together, that doesn't work either.
Now, I can figure out how to stick an ASCII 176 character into a text file and
get an actual degree symbol inside a literal string that way, though it's
rather a pain, and it shows up as "45\260 North" in an xterm. But what if I
want some other kind of expression that I can't just type in as a string?
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Expression in plot text
3 messages · Trent Piepho, Thomas Lumley, Roger Koenker
On Wed, 6 Dec 2000, Trent Piepho wrote:
I'd like to put a degree symbol in the title of a plot. Something like:
plot(1,main=expression("Data at " * 45 * degree * " North"))
That works fine, but I like the 45 to be the value of a variable, instead of a
constant, an in:
lat <- 45
plot(1,main=expression("Data at " * lat * degree * " North"))
I think you'll find this in the FAQ. In any case.
lat<-45
plot(1,main=substitute("Data at "*lat*degree*" North",list(lat=lat)))
-thomas
Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
As it happens I was also trying to do something similar and had a window open with Brian's response to a similar question last August. Here is it:
On Tue, 29 Aug 2000, Yudi Pawitan wrote:
I'm putting a title over different plots, where 'that' varies. How do I make the value appear? Example: that <- 1 plot(1:10) title(m
expression(paste(hat(theta),'= ',that))) We've been here before. To get an expression either use parse on your pasted character string or substitute on an expression. There are worked examples in the list achives. The neatest is title(substitute(hat(theta) == that, list(that=that))) (note it is == not =) url: http://www.econ.uiuc.edu Roger Koenker email roger at ysidro.econ.uiuc.edu Department of Economics vox: 217-333-4558 University of Illinois fax: 217-244-6678 Champaign, IL 61820
On Wed, 6 Dec 2000, Trent Piepho wrote:
I'd like to put a degree symbol in the title of a plot. Something like:
plot(1,main=expression("Data at " * 45 * degree * " North"))
That works fine, but I like the 45 to be the value of a variable, instead of a
constant, an in:
lat <- 45
plot(1,main=expression("Data at " * lat * degree * " North"))
But this doesn't work of course, the graph title is "Data at lat° North". If
I try to paste expressions and strings together, that doesn't work either.
Now, I can figure out how to stick an ASCII 176 character into a text file and
get an actual degree symbol inside a literal string that way, though it's
rather a pain, and it shows up as "45\260 North" in an xterm. But what if I
want some other kind of expression that I can't just type in as a string?
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._