[R] graph label greek symbol failure

Gavin Simpson gavin.simpson at ucl.ac.uk
Wed Aug 19 18:47:46 CEST 2009


On Wed, 2009-08-19 at 17:06 +0100, e-letter wrote:
<snip />
> >
> Being familiar with latex, I interpret your description of the tilde
> (~) as non-breaking space, therefore I used the command:
> plot(1:10,ylab=expression(temperature~delta*t))
> to give me the result I wanted; in other words the space characters
> are not needed between temperature,~ and delta in your suggestion.

No, the spacing is not needed, just like any other spacing in R, it is
ignored, but my eye-brain wetware system is /not/ the R parser and as
such I like to space things out so *I* can parse and *understand* my
code; I find it easier to find syntax errors etc that way.

Note that there was a difference between what I posted and Baptiste's
example; there the space was explicitly encoded within "temperature ",
where as I use "~" as the indicator for spacing; any other spacing was
just for sake of legibility.

I also don't think this is non-breaking because unless you add an
explicit \n (newline) in your label, the entire label will be rendered
on a single line.

Better to think of 
x ~ y (or x~y if you think that is more readable)

as just putting spacing between x and y. As ?plotmath shows, you can
string multiple ~ together to give extra spacing;

x ~~ y

And so on...

Glad you got this working as you wanted.

G

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