[R] depth of labels of axis

David L Carlson dcarlson at tamu.edu
Tue Sep 2 20:50:40 CEST 2014


The bottom of the expression is set by the lowest character (which can even change for subscripted letters with descenders. The solution is to get axis() to align the tops of the axis labels and move the line up to reduce the space, e.g.

plot(1:5, xaxt = "n")
axis(1, at = 1:5, labels = c(expression(E[g]), "E", expression(E[j]), 
"E", expression(E[t])), padj=1, mgp=c(3, .1, 0))
# Check alignment
abline(h=.7, xpd=TRUE, lty=3)

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Jinsong Zhao
Sent: Monday, September 1, 2014 6:41 PM
To: r-help at r-project.org
Subject: [R] depth of labels of axis

Hi there,

With the following code,

plot(1:5, xaxt = "n")
axis(1, at = 1:5, labels = c(expression(E[g]), "E", expression(E[j]), 
"E", expression(E[t])))

you may notice that the "E" within labels of axis(1) are not at the same 
depth. So the vision of axis(1) labels is something like wave.

Is there a possible way to typeset the labels so that they are have the 
same depth?

Any suggestions will be really appreciated. Thanks in advance.

Best regards,
Jinsong

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



More information about the R-help mailing list