<Width of Each bar - geom_bar(width=)>
Width of bars is set to 0.9
So If you made the bar graphs without designating width, the width of the bins are automatically made having width=0.9
> airquality2<-airquality%>%group_by(Month)%>%summarise(mean_temp=mean(Temp))
> ggplot(data=airquality2,aes(x=Month,y=mean_temp)) +geom_bar(stat="identity") |
> ggplot(data=airquality2,aes(x=Month,y=mean_temp)) +geom_bar(stat="identity",width=0.9) |
|
|
> ggplot(data=airquality2,aes(x=Month,y=mean_temp))+geom_bar(stat="identity",width=0.5)
width=1 is the longest width possible to be made.
> ggplot(data=airquality2,aes(x=Month,y=mean_temp))+geom_bar(stat="identity",width=1)
<distance between bins - geom_bar(position=position_dodge()>
Not only the width of bins but also the distance between bins are set to 0.9
So If you made the bar graphs without designating width and the distance, the width of the bins are automatically made having width=0.9, and also the distance of bins are automatically made as 0.9
So graphs below are exactly same with width=0.9, and the distance of bins=0.9
> ggplot(data=Ozone_temp_rate,aes(x=Ozone_rank,y=per,fill=temp_rank)) +geom_bar(stat="identity", position="dodge") |
> ggplot(data=Ozone_temp_rate,aes(x=Ozone_rank,y=per,fill=temp_rank)) +geom_bar(stat="identity",width=0.9, position=position_dodge(0.9)) |
|
|
The width of bins and the distance between bins are automatically 0.9. If you want to make some space between bins, you should designate the distance of bins than the width of each bin.
For example, when with of each bin is 0.5, the number inside position=position_dodge() should be bigger than 0.5
> ggplot(data=Ozone_temp_rate,aes(x=Ozone_rank,y=per,fill=temp_rank))+geom_bar(stat="identity",width=0.5 ,position="dodge")
> ggplot(data=Ozone_temp_rate,aes(x=Ozone_rank,y=per,fill=temp_rank))+geom_bar(stat="identity",width=0.5,position=position_dodge(0.7))