Trying to facet out a barplot of survey responses. Each facet should have the percent answers to the question while annotating each facet with the number of respondants. Everything seems to work fine until add the annotation with geom_text which messes up the scale. Cant figure out why.
This seems to work fine
ggplot(dat2, aes(Q1a)) +geom_bar(aes(y = ..prop.., group = D3b) ) +
coord_flip() + facet_wrap(~ D3b) + labs(x="",y="") +
scale_y_continuous(labels = percent)
and gets me this, which has the barplots scaled the way I need them
But when I add geom_text the scale gets all messed up
ggplot(dat2, aes(Q1a)) +geom_bar(aes(y = ..prop.., group = D3b) )+
coord_flip() + facet_wrap(~ D3b) + labs(x="",y="") +
scale_y_continuous(labels = percent)+ geom_text(data=dat2.cor,
aes(x=0,y=0,label=n), nudge_x = 10, nudge_y=20,
colour="black",inherit.aes=FALSE)
dat2.cor
is a separate dataset I created with data annotate the facets which looks like this:
Anybody have any idea whats going on here?