Plotting a stacked bar plot?

ggplot(df, aes(x = factor(Time), y = Value, fill = factor(Type))) + 
geom_bar(stat="identity", position = "stack")

enter image description here

 ggplot(df, aes(x = factor(Time), y = Value, fill = factor(Type))) + 
 geom_bar(stat="identity", position = "dodge")

enter image description here

You can do one or the other but not both. When they are dodged, the different values of type are being used. By adding a color outline, you can see that.

 ggplot(df, aes(x = factor(Time), y = Value, fill = factor(Type))) + 
 geom_bar(stat="identity", position = c("dodge"), colour="black") 

enter image description here

Leave a Comment