Skip to content
Prev 78193 / 398502 Next

Placing axes label strings closer to the graph?

Use mtext() to put labels in the margin line you want.  title() writes 
xlab and ylab in line 3 AFAIR.  So you could use something like

par(mai=c(0.6,0.6,0.2,0.2))
plot(D$dates, D$inflation,
      type="l", lwd=2, col="cadetblue4", cex.axis=0.6)
mtext("X label string", 1, line=2, cex = 0.6)
mtext("Y label string", 2, line=2, cex = 0.6)

*However*, your error is to use cex to change the font size, not pointsize 
(which scales the lines suitably). Try instead

pdf(file="inflation.pdf", width=2.8, height=2.8, pointsize=6)
plot(D$dates, D$inflation, xlab="X label string", ylab="Y label string",
      type="l", lwd=2, col="cadetblue4")
On Sat, 1 Oct 2005, Ajay Narottam Shah wrote: