next up previous
Next: Nice dots/points in scatterplots Up: Graphics and output Previous: Saving graphics in other

Using Greek letters and other manipulations in figure labels, etc.

Some of this can be done in R/S directly and some is most easily done by directly manipulating the resulting postscript file. Remember that postscript is just a programming language and a postscript file is a code file that is interpreted by the printer. You can muck around in there to your heart's content, so long as what you do conforms to the postscript language. Simple stuff is pretty straightforward via trial and error.

Suppose I want my figure label to read ' $\mbox{{NCEP} \ensuremath{\sigma_{0.995}}}$' . I can get partway there as follows:
plot(x,y,xlab=NCEP,ylab=the other axis)  
mtext(side=1,line=3,font=13,s)  
mtext(side=1,line=3,0.995,cex=0.5)
The font=13 specifies Greek letters. If you don't know which characters correspond to which greek letters, you can play around some; s is an obviously-inspired guess for $\sigma$. The problem here is that this will pile NCEP, $\sigma$ and 0.995 on top of each other. So, next go into the postscript file, search for the characters of interest, and move things around as necessary. (You might also be able to do the moving around within R/S by using the locator() function.) If it will be too hard to find something as common as 's', you could replace it with something unusual in the R/S code and then change it back in the postscript. Here's an example of the altered postscript code with the original lines commented out with '%'.
13 Sf  
%(s) 61 2739 0.5 T  
(s) 61 2784 0.5 T  
1 Sf  
0.8 Sx  
%(0.995) 71 2739 0.5 T  
(0.995) 81 2854 0.5 T  
1 Sx 
The lines that are commented out with the '%' are what I replaced in order to move the and 0.995 to where I wanted them, based on trial and error. The two numbers I changed in each line are the x and y coordinates of the stuff in parentheses. Note that had I not included the 'font' and 'cex' arguments in the S/R code, I could have just as easily accomplished the same thing in the ps file by inserting the '13 Sf' line to change the font to 13 and then the '1 Sf' line to change the font back, and similarly with the '0.8 Sx' and '1 Sx' lines.

Keywords: R, Greek, letters, figures, graphics

Last modified 6/23/07.


next up previous
Next: Nice dots/points in scatterplots Up: Graphics and output Previous: Saving graphics in other
Chris Paciorek 2012-01-21