By adding a size
to your data frame and moving those parameters within your geom_text
aes
()` this seems to plot ok for me. I think..
Data$size <- size
p <- ggplot(data = Data, aes(x = factor(''), y = Freq, fill = Var1)) +
geom_bar(stat = "identity",position = "fill", width = 1) +
scale_fill_brewer(palette = 3) +
geom_text(aes(y = y, label = label,
position ="identity", face = "bold", size = size), hjust=0.5,
vjust=0.5) +
xlab('') + ylab('') + labs(fill = '') + ggtitle('Example') +
theme(axis.text.y = element_text(size=14,face="bold"),
panel.background = element_blank(),
plot.title = element_text(size = 20, colour = "black", face = "bold")) +
facet_grid(facets = . ~ Var2) +
guides(size=FALSE)
Also if you add + guides(size=FALSE)
to the end as I have done this will remove your size legend.
My explanation for this, might be wrong, is that once you facet you were still providing a full length size
and not allowing facet to chop the size data according to Var2
.
I think your problem with the sizing is that size
you only have two sizes you are getting big differences (there must be some relative scaling maybe), perhaps add + scale_size(range=c(6,10))
and play with this to get something more appropriate? The 6,10
size range looks much better to me.