In ggplot2, I want to make bar_plot align with axis x (remove the blank area as attached image ). When use expand_limits(y=0)
, it seems can't work.Anyone can help ? Thanks!
library(tidyverse)
library(RColorBrewer)
data <- data.frame(category=c("a","b","c","d"),value=4:1)
data %>% ggplot(aes(category,value,fill=category))+
geom_bar(stat='identity')+scale_fill_brewer(palette='Greens',direction=-1)+
expand_limits(y=0)