Readers, I have tried to use a plotmath command to add the temperature degree sign (i.e. ? C) to the axis label of a graph:> x<-(1:10) > y<-(200:191) > plot(x~y,ylab=expression(*degree~C))Error: syntax error, unexpected '*', expecting ',' in "plot(x~y,ylab=expression(*" According to plotmath manual, the syntax is '*degree' and I am able to use this command when a number precedes the asterisk (e.g. ylab=expression(0*degree~C)). But I want to omit the need for a number before the degree sign. Any advice please?
Hi, You cannot start with a "*" in expression(). Try this, plot(x~y,ylab=expression(~degree~C)) or even, as a short-cut, plot(x~y,ylab=~degree~C) HTH, baptiste 2009/10/2 e-letter <inpost at gmail.com>:> Readers, > > I have tried to use a plotmath command to add the temperature degree > sign (i.e. ? C) to the axis label of a graph: > >> x<-(1:10) >> y<-(200:191) >> plot(x~y,ylab=expression(*degree~C)) > Error: syntax error, unexpected '*', expecting ',' in > "plot(x~y,ylab=expression(*" > > According to plotmath manual, the syntax is '*degree' and I am able to > use this command when a number precedes the asterisk (e.g. > ylab=expression(0*degree~C)). But I want to omit the need for a number > before the degree sign. Any advice please? > > ______________________________________________ > 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. >
Hi If you use a Microsoft OS and you just want to do a ?C in the text there is the alternative of using ASCII Just press the keys Alt-248. Have used it for a number of years with success. Also applies to other characters and without having to go to plotmath etc You just need to be careful of the code page etc for it to work. Regards Duncan Mackay Department of Agronomy and Soil Science University of New England ARMIDALE NSW 2351 Email Home: mackay at northnet.com.au At 16:49 2/10/2009, you wrote:>Readers, I have tried to use a plotmath command to add the temperature >degree sign (i.e. ??? C) to the axis label of a graph: > x<-(1:10) > >y<-(200:191) > plot(x~y,ylab=expression(*degree~C)) Error: syntax error, >unexpected '*', expecting ',' in "plot(x~y,ylab=expression(*" According to >plotmath manual, the syntax is '*degree' and I am able to use this command >when a number precedes the asterisk (e.g. ylab=expression(0*degree~C)). >But I want to omit the need for a number before the degree sign. Any >advice please? ______________________________________________ >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.