views:

182

answers:

1

Hi, I was trying to create a graph in R Plot and was just wondering if there was any way to move the side header lable closer to the graph.
I've made the font smaller and put the lable into two lines, but when I put it into two lines the top line falls off the screen and the bottom line is rather far away from the numbered Y-Axis of the graph. Is there anyway to move the label closer to the y-axis so the whole thing is visible? Thanks, ~Sam

+3  A: 

Try tweaking mar:

mar.old <- par('mar')
print(mar.old)

par(mar=rep(10, 4)) # some ridiculous values
plot(density(rnorm(1000)), ylab='foo\nbar\nbaz\nquux')

par(mar=mar.old) # restore original

See ?par for more info on mar:

mar A numerical vector of the form c(bottom, left, top, right) which gives the number of lines of margin to be specified on the four sides of the plot. The default is c(5, 4, 4, 2) + 0.1.

ars
+1. You could also try changing the 'mgp' parameter, e.g. par(mgp=c(2,1,0)).
Richie Cotton
This completly worked! Thanks so much!