Chris Solomon
2012-Dec-04 19:05 UTC
[R] control point size of superscript when labeling axes with title()
Hi- A journal has asked me to make all of my text annotations on a figure at 10-point size. For the most part this is easy, e.g. by creating figures with: pdf(..., family='Times', pointsize=10) But where I have superscripts (or subscripts) in axis labels, the default seems to be to shrink the superscripted text slightly. For example this code: title(ylab=expression(paste('Respiration (mg ',O[2],' ',L^-1,' ',d^-1,')',sep=' ')),outer=T,line=0.3) produces superscripted numbers at approximately 7 point. I have been poking around for a solution but not having much luck. The textstyle() function keeps superscripted text at original size if you use it within a text() call, but I can't figure out an equivalent solution within a title() call. Thanks for any suggestions Chris ------ Dr. Chris Solomon Assistant Professor Dept. of Natural Resource Sciences McGill University [[alternative HTML version deleted]]
David Winsemius
2012-Dec-05 01:19 UTC
[R] control point size of superscript when labeling axes with title()
On Dec 4, 2012, at 11:05 AM, Chris Solomon wrote:> Hi- > > A journal has asked me to make all of my text annotations on a figure at 10-point size. For the most part this is easy, e.g. by creating figures with: > pdf(..., family='Times', pointsize=10) > > But where I have superscripts (or subscripts) in axis labels, the default seems to be to shrink the superscripted text slightly. For example this code: > title(ylab=expression(paste('Respiration (mg ',O[2],' ',L^-1,' ',d^-1,')',sep=' ')),outer=T,line=0.3) > produces superscripted numbers at approximately 7 point. > > I have been poking around for a solution but not having much luck. The textstyle() function keeps superscripted text at original size if you use it within a text() call, but I can't figure out an equivalent solution within a title() call.It is not the fact that you are using title, but rather (I think) the fact that numbers are handled differently than text in plotmath. You are also unnecessarily using 'paste' and incorrectly including 'sep' argument in plotmath-paste, which does not honor that argument. Regular R-paste != plotmath-paste Quoting the exponents allows textstyle to do its job properly.> plot(1,1, ylab="") > title(ylab = expression(Respiration~"("*mg~~O[2]~~L^textstyle("-1")~d^textstyle("-1")*')') ,line= 1.5)> [[alternative HTML version deleted]] >You might want to read what the Posting Guide says about HTML posting.> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius, MD Alameda, CA, USA