Reputation: 1
I am plotting a bar plot with ggplot2. I want the bar width is very small,but the distance between the bars is very large, like the picture, how can I change the distance?
Upvotes: 0
Views: 271
Reputation: 1922
This question has been aswered at ggplot2 : How to reduce the width AND the space between bars with geom_bar
library(tidyverse)
ggplot(data = iris,
mapping = aes(x = Species,
y = Sepal.Length))+
geom_col(width = .5)+
theme(aspect.ratio = 3/2)
Upvotes: 0
Reputation: 736
Here is an example ggplot(data = df, aes(x=X, y=Y, fill=F)) + geom_bar(width = 0.5, position = position_dodge(width = 0.8))
position_dodge(width = 0.8)
is for the space between the bars. width = 0.5
is an example for the withd of the bar itself.
Let me know if it worked :)
Upvotes: 0