I've plotted a bar chart in ggplot and converted it using ggplotly. I want the tooltip to display relative and absolute frequencies within each bar of the chart. I try to do this the following way:
gg + stat_count(geom="text",
aes(label=..count.., "share"=scales::percent(..count../tapply(..count.., ..x.. sum)[..x..])), position=position_fill(vjust=0.5), colour="white")
This information is printed to the tooltip, but in a not so good looking way:
I've tried to get rid of this formula part in different ways, but wasn't successful so far. Can any of you help?