[R] how to label plots?
MSchwartz at medanalytics.com
Tue Feb 3 02:28:38 CET 2004
On Mon, 2004-02-02 at 17:25, David Andel wrote:
> With main="Title" I can write centered above the plot.
> Is there also a way to write into the left (or right) upper corner?
> I'd like to label my plots by (a), (b), ...
# Create a basic plot
# Now set the outer plot margin to 1 line at the top
# and 0 for bottom, left and right
# See ?par for more information
par(oma = c(0, 0, 1, 0))
# Now use mtext() to place text in the outer margin
# The outer margin coordinates go from 0 to 1
# See ?mtext for more information
#For the upper left hand corner, use the following:
mtext("(a)", side = 3, line = 0, at = 0, outer = TRUE, adj = 0)
#For the upper right hand corner, use the following:
mtext("(b)", side = 3, line = 0, at = 1, outer = TRUE, adj = 1)
You can play with the outer margin settings for more space if you wish
and the 'adj' argument in mtext() manipulates the positioning of the
text at the "x,y" coordinate of "line, at".
More information about the R-help