5
votes

Do the rgl routines accept the use of "expression" for Greek letters and super/sub script for axis labelling?

Something like

xlab=(expression(paste("Lyman ",alpha,)))

works perfectly well in a normal plot call but just seems to display "(paste("Lyman ",alpha,)" as my axis label in plot3d and decorate3d. If not, how can I add these characters to my 3D scatterplots generated using plot3d?

1
Basically , no. The author and maintainer of pkg:rgl has said it would be nice but too difficult to build plotmath capability into that package. You need to tell us what font (which requires knowing which graphics device) you are using if you want accurate advice. - IRTFM
I thought I might be able to come up with a kludgy answer but have basically failed. Duncan Murdoch at times in the past has suggested using a "sprite" to which you have bitmapped the desired symbol. - IRTFM
OK. Shame, but thanks for clarifying that it is not possible. I'll just have to paste the labels on using a lesser package then. - Karen Aplin
This was what I hammered together for someone who wanted a floating rgl legend: stackoverflow.com/questions/19045208/…. It's sometimes possible to build character values that print out greeks using UTF-8 or Unicode. This requires know what glyphs are in your RGL fonts. In my console font I get the lowercase greeks with: intToUtf8(945:960) [1] "αβγδεζηθικλμνξοπ" - IRTFM
The Unicode modern greeks: alanwood.net/demos/symbol.html#s0370 (The lowercase greeks also start at 945.) - IRTFM

1 Answers

3
votes

On my system (OSX 10.7.5, R 3.1.2) I get an alpha as xlab with:

require(rgl)
plot3d(1,1,1,xlab=intToUtf8(0x03B1L) )

And pasting to ordinary text also succeeds:

plot3d(1,1,1, xlab=paste("Lyman ", intToUtf8(0x03B1L) ) )