[R] expressions as axis labels
Patrick Buetzberger
patrick at giub.unibe.ch
Sat May 25 09:42:31 CEST 2002
Dear colleagues,
I often use chemical formulas to label my x-axis, e.g. in barplots. I
used to do this like the following example and it worked just fine:
a <- seq(2,24,2)
b <- seq(3,36,3)
c <- rbind(a,b)
barplot(c, width=c(0.9, 1.1),space=c(0.2, 0.75), col=c("indianred4",
"yellow2"), beside = TRUE,
xlab="Ions", yaxt="n", xaxt="n", ylab = expression(paste("weighted mean
concentration [",mu*eq*l^-1,"]")),
ylim = c(0,40))
axis(2,las=2,
pos=0.4,at=c(0,10,20,30,40),lab=c(0,10,20,30,40),cex.axis=1.0)
axis(1,at=seq(1.8,34.25,2.95), lab=expression(F^{-''}, Cl^{-''},
NO[2]^{-''},
NO[3]^{-''}, PO[4]^{3-''}, SO[4]^{2-''}, Na^{+''}, NH[4]^{+''}, K^{+''},
Mg^{2+''}, Ca^{2+''}, H^{+''}),cex.axis=1.0)
The important point is the x-axis here: before we installed the new R
1.5 on our workstations, the chemical formulas were properly aligned and
looked well. Ever since, if I use the exact same procedure, I get the
graphic but the chemical formulas are not aligned horizontally properly
anymore: e.g. Mg^{2+''} or NO[3]^{-''} are a bit higher than F^{-''} or
H^{+''} (it seems to depend on whether there is a subscript or a letter
with a part below the main line like a 'g').
I didin't find any hint on the r-project homepage. I don't know if we
forgot some feature when newly installing R or if something changed in
version 1.5.
Thanks very much for any hints!
Patrick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patrick.vcf
Type: text/x-vcard
Size: 339 bytes
Desc: Card for Patrick Buetzberger
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20020525/9252070a/patrick.vcf
More information about the R-help
mailing list