Entering edit mode
3.0 years ago
Space_Life
▴
50
Hi, I am trying to create a simple stacked bar plot in ggplot. I am probably the only one not getting this one. I went through so many youtube tutorials. All have complex data set examples, but not a simple example. Here is my example data
I want to get a plot like this.
My trial code that is not working:
type <- rep(c("Type1", "Type2", "Type3")) ggplot(data = data, aes(y = Name, x = type))+ geom_bar(position = "stack", stat = "identity")+ labs(x= "Type", y = "Name")+ theme_classic()
Hope to get your help. Thank you in advance.
Thank you so much. This worked well :)