0

I would like to remove the space between the x axis and the x ticks. It would be the area in the red rectangle. Eg.

ggplot(mtcars, aes(factor(cyl))) + geom_bar()

I came across with loads of info on x label spacing but not on the distance between the x labels and the x axis.

enter image description here

user3507584
  • 2,670
  • 5
  • 30
  • 54

1 Answers1

1

Just add scale_y_continuous(expand = c(0,0)) to your ggplot:

ggplot(mtcars, aes(factor(cyl))) + geom_bar() + 
  scale_y_continuous(expand = c(0, 0))

Boxplot with removed area between x-axis and plot-area

rhole
  • 430
  • 2
  • 8