[R] expressions as axis labels

Ole Christensen o.christensen at lancaster.ac.uk
Sat May 25 11:52:26 CEST 2002


Hi Patrick

You can make you code work by putting a [NULL] at appropriate places.

axis(1,at=seq(1.8,34.25,2.95), lab=expression(F[NULL]^{-''},
Cl[NULL]^{-''}, NO[2]^{-''}, NO[3]^{-''}, PO[4]^{3-''}, SO[4]^{2-''},
Na[NULL]^{+''}, NH[4]^{+''}, K[NULL]^{+''}, Mg[NULL]^{2+''},
Ca[NULL]^{2+''}, H[NULL]^{+''}),cex.axis=1.0)


I do not understand what causes the behaviour you have observed, and if
this is intended 
(probably someone more clever than me can explain this).


Ole


Patrick Buetzberger wrote:
> 
> 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

-- 
Ole F. Christensen
Department of Mathematics and Statistics
Fylde College, Lancaster University 
Lancaster, LA1 4YF, England
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list