[R] negative superscripts in axis labels

From: glen e. p. ropella <gepr_at_tempusdictum.com>
Date: Tue 30 Aug 2005 - 07:21:23 EST

Hash: SHA1

I apologize if this has been covered somewhere; but, I cannot find it.

The following results in a segmentation fault:

- -----------------------------------------------------------------
helvetica <- X11Font("-*-helvetica-*-*-*-*-*-*-*-*-*-*-*-*") X11Fonts(helvetica=helvetica)
symbol <- X11Font("-*-symbol-%s-%s-*-*-%d-*-*-*-*-*-*-*") X11Fonts(symbol=symbol)
X11(width=864, height=432,
~ fonts=c(X11Font(helvetica), X11Font(symbol)))

x <- seq(0,1,.0001)
y <- sin(x)

tics <- c(10^-5,10^-4,10^-3,10^-2,10^-1,10^-0)
lab0 <- expression(10^-0)
lab1 <- expression(10^-1)
lab2 <- expression(10^-2)
lab3 <- expression(10^-3)
lab4 <- expression(10^-4)
lab5 <- expression(10^-5)

- ------------------------------------------------------------------

However, if I remove the "-" symbols in the labels, e.g. ~ lab0 <- expression(10^0)
everything works just dandy.

Or, if I use par (family="sans") instead of setting the font family using the X font string directly, the negative superscripts also work. But, I have reasons for defining the font mappings manually.

Does anyone have any idea how I can get the negative superscripts to work while using the explicitly defined font mappings? Perhaps there's a sprintf() function down in there somewhere that requires more C format arguments? (causing the axis function to wrongly access memory when it uses the font mapping)

In the meantime, even when I simply increase the size of the axis labels using cex.axis (e.g. par(cex.axis=1.02)), the "-" is just dropped from those labels. So, if I use: lab1 <- expression(10^-1), I get 10^1 in the output. I've tried all manner of inserting phantom() calls and those don't work. It's like the negative is ignored when the font size increases.

Thanks very much for any pointers.
- --glen
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDE3xTZeB+vOTnLkoRAosIAJoCzCaOqZjkC+TjsdO7fttZojFJIQCfWItm HafgrPzreKVoOBSB61+ykBE=

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Aug 30 07:48:59 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 16:02:53 EST