My df looks like:
1 with score
125 without score
I'd like to make piechart in ggplot:
ggplot(data = df_pp, aes(x = "", y = Number/sum(Number),fill = PolyPhen_score)) + geom_bar(stat="identity") + coord_polar(theta='y') +
ggtitle("Variants with PolyPhen score and without PolyPhen score") +
scale_y_continuous(labels = percent) + labs(x = "", y = "") +
theme(panel.background = element_rect(fill = 'white')) +
geom_text(aes(label = paste(round(Number/sum(Number)*100),"%")),vjust = 5)
But my labels 1% and 99% are overlapped on the piechart.
If I add this code, it doesn't help:
geom_text(aes(y=Number/2 + c(0,cumsum(Number)[-length(Number)]), label = percent(Number/100)), size=5)