Question

I was trying to create a graph in R Plot and was just wondering if there was any way to move the side header label closer to the graph.

I've made the font smaller and put the label 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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top