2016-08-01 54 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