Skip to content
Prev 43571 / 398506 Next

how to label plots?

On Mon, 2004-02-02 at 17:25, David Andel wrote:
# Create a basic plot
plot(1:5)

# 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".

HTH,

Marc Schwartz