0

I have this graphic in ggplot2 and I would like to add in graph counts in each segment or percentage maybe. Counts are in table here

kod is factor of 5 groups stamg is factor 0/1

ggplot(databak, aes(factor(kod), fill = factor(stamg))) +
  geom_bar(position = "fill")

that is my geom bar plot without counts

this is a table of counts

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
  • Use `geom_text()` as explained in this [question](http://stackoverflow.com/questions/12018499/how-to-put-labels-over-geom-bar-for-each-bar-in-r-with-ggplot2) – Diego Aguado Apr 17 '16 at 10:48
  • I am sorry, but I don´t get it. How can I create y variable of counts? Please, write me the code geom_text, thank you! – Anna Smržová Apr 19 '16 at 07:24
  • Your question could use some editing... you are using databak (a data frame I presume) to generate your plot (right?) but then you provide another dataframe (doesn't look like its databak). Is that last dataframe extra information which you want to use in the plot? – Diego Aguado Apr 19 '16 at 08:35

0 Answers0