2016-08-01 219 views
0

我想删除x轴和x刻度之间的空间。这将是红色矩形区域。例如,删除x轴和x刻度之间的区域

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

我遇到了大量的x标签间距的信息,但不是x标签和x轴之间的距离。

enter image description here

回答

0

只需添加scale_y_continuous(expand = c(0,0))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