1

I try to make a bar chart with ggplot with multiple dimensions. Then I would like to get the sum for the bar chart exactly in the middle of every bar, however they are stacked above each other. Any suggestions?

b<-as.data.table(aggregate(betrerg ~ Region+GK2, na.data2, mean))
b$betrerg<-round(b$betrerg,-3)
ggplot(b, aes(y=betrerg,x=GK2,label=b$betrerg)) + geom_bar(aes(fill=Region),position = "dodge",stat = "identity")
+ggtitle("Verteilung der organisationsform pro Kanton (Kooperationsform)")+labs(x=NULL, y="Anzahl")+theme(axis.text.x = element_text(angle = -50, hjust = 0))
+geom_text(aes(label=(b$betrerg/1000)),size=2, position = position_dodge(0.9), vjust = -0.2)

In exel it is very easy to do it

multi dimension barchart

multi dimension barchart

desired result, from exel

desired result, from exel

Uwe
  • 39,148
  • 11
  • 82
  • 123

0 Answers0