Dear R help list members, I am experiencing difficulty in trying to generate a subscript '2' in an axis label. Although I can get the '2' into a subscript using expression(), R then forces me to leave at least one space between the '2' and the following character. My label is supposed to read 'N2O concentration (ppm)', and the space between the '2' and the 'O' makes it look rather inelegant! My code is the following (the comments in it are there to stop me forgetting what I have done, I am new to R): postscript(file="/Users/patrickmartin/Documents/York Innova Precision/N2Oinnova.eps", horizontal=FALSE, onefile=FALSE, height=4, width=5, pointsize=10)> plot(n2o, lty=0, las=1, xlab="Time", ylab=expression(N[2]~"O > concentration (ppm)")) points(n2o, pch=16) # suppresses line but adds > points dev.off() # turns postscript device off againOne possibility is for me to simply leave two spaces everywhere else, but that looks a little strange. Does anyone know of a more elegant way of solving the problem? A related query is that the journal I want to publish this figure in specifies that if EPS format is used, the font should be either Arial, Courier, Helvetica, Times or Symbol. Is one of these the default font for an EPS file in R, and if not, is there a possibility of changing it? Thanks a lot in advance, Patrick Martin
pm509 at york.ac.uk wrote:> Dear R help list members, > > I am experiencing difficulty in trying to generate a subscript '2' in an > axis label. Although I can get the '2' into a subscript using expression(), > R then forces me to leave at least one space between the '2' and the > following character. My label is supposed to read 'N2O concentration > (ppm)', and the space between the '2' and the 'O' makes it look rather > inelegant! My code is the following (the comments in it are there to stop > me forgetting what I have done, I am new to R): > > postscript(file="/Users/patrickmartin/Documents/York Innova > Precision/N2Oinnova.eps", horizontal=FALSE, onefile=FALSE, height=4, > width=5, pointsize=10) >> plot(n2o, lty=0, las=1, xlab="Time", ylab=expression(N[2]~"O >> concentration (ppm)")) points(n2o, pch=16) # suppresses line but adds >> points dev.off() # turns postscript device off againIs this better plot(1:10, ylab = expression(paste(N[2],"O concentration (ppm)", sep = ""))) ? HTH, Tobias -- Tobias Verbeke - Consultant Business & Decision Benelux Rue de la r?volution 8 1000 Brussels - BELGIUM +32 499 36 33 15 tobias.verbeke at businessdecision.com
Tobias Verbeke
2007-Jun-03 10:28 UTC
[R] specify font family for postscript device [was: Re: Subscript in axis label]
pm509 at york.ac.uk wrote:> Dear R help list members,<snip>> A related query is that the journal I want to publish this figure in > specifies that if EPS format is used, the font should be either Arial, > Courier, Helvetica, Times or Symbol. Is one of these the default font for > an EPS file in R, and if not, is there a possibility of changing it?See ?postscript and in particular the family argument the details of which are treated in the Families section. HTH, Tobias -- Tobias Verbeke - Consultant Business & Decision Benelux Rue de la r?volution 8 1000 Brussels - BELGIUM +32 499 36 33 15 tobias.verbeke at businessdecision.com