I would like to place my labels on the piechart, not in the legend. In other words, I would like the name of the party to appear centered on the graph rather than to the right. How would I do this?
Sample DF:
> data_party$party[1:20]
[1] "Independents" "Independents" "Independents" "Independents" "Democrats"
[6] "Democrats" "Democrats" "Democrats" "Independents" "Independents"
[11] "Democrats" "Democrats" "Democrats" "Democrats" "Democrats"
[16] "Independents" "Democrats" "Democrats" "Independents" "Democrats"
Sample vector from column:
# pie graph for party
data_party <- subset(data, subset=!is.na(data$Q7))
data_party$party[data_party$Q7==1]<-"Democrats"
data_party$party[data_party$Q7==2]<-"Republicans"
data_party$party[data_party$Q7==3]<-"Independents"
data_party$party[data_party$Q7==4]<-"None"
pie <- ggplot(data_party, aes(x = "Party Affiliation", fill = factor(party))) + geom_text(aes(y = party, label=party)) + geom_bar(width = 1) + theme(panel.background = element_blank())
pie + coord_polar(theta = "y") + theme(legend.title=element_blank())+ theme(axis.title.x = element_blank()) + theme(axis.title.y = element_blank())