I have a data frame like below:
id month type count
___ _______ ______ ______
1 1 1 10
1 1 2 09
1 1 3 26
1 2 1 60
1 2 2 90
2 2 3 80
2 1 1 10
2 1 2 09
2 1 3 26
2 2 1 60
2 2 2 90
2 2 3 80
3 1 1 10
3 1 2 09
3 1 3 26
3 2 1 60
3 2 2 90
3 2 3 80
I thought the best way to visualize is a stacked group bar something like the below:
So I tried with
ggplot(df,aes(x=id,y=count,fill=month))+geom_bar(stat="identity",position=position_dodge())+geom_text(aes(label=count),size=3)
Which gave a plot which was a bit different than my expectation.Any help is appreciated.
See Question&Answers more detail:os