ClementWalter
ClementWalter

Reputation: 5324

How to change spacing between axis label and ticks labels with ggplot2?

This seems a very basic question but I can't find the answer: how to change the default spacing between the axis main label and the axis ticks label? I have looked through theme documentation but could find only the axis.ticks.margin option which lets set the spacing between ticks and ticks label.

For example,

df <- data.frame(x = 1:5, y = seq(from=1, l = 5))
ggplot(df, aes(x,y)) + geom_line()

produces the following:

example

where I'd like to add more space between the label y and the axis (y and 3 are too close for me).

Upvotes: 5

Views: 10032

Answers (1)

Tomas H
Tomas H

Reputation: 713

You can try this as well

df <- data.frame(x = 1:5, y = seq(from=1, l = 5))
ggplot(df, aes(x,y)) + geom_line()+
    ylab("y\n\n")

Upvotes: 3

Related Questions