EDITED
I have the following example where I create 3 pie charts , but I would like to have them 3 combined into 1 pie + donuts pie. Besides, it would be really useful to have the numbers as well, how can this be accomplished? Thanks a lot.
df.mut <- data.frame(Avrg.muts.HLA.A11.A24=c(20.20000,37.39286,11.85714,50.26087,20.20000,37.39286,11.85714,50.26087,20.20000,37.39286,11.85714,50.26087), Avrg.muts.HLA.A11=c(32.86842,32.86842,35.72973,35.72973,32.86842,32.86842,35.72973,35.72973,32.86842,32.86842,35.72973,35.72973), Avrg.muts.HLA.A24=c(15.33333,43.19608,15.33333,43.19608,15.33333,43.19608,15.33333,43.19608,15.33333,43.19608,15.33333,43.19608), variable=c("HLA.A11.A24","HLA.A11.A24","HLA.A11.A24","HLA.A11.A24","HLA.A11","HLA.A11","HLA.A11","HLA.A11","HLA.A24","HLA.A24","HLA.A24","HLA.A24"), value=c("+/+","+/-","-/+","-/-","+","+","-","-","+","-","+","-"))
df.mut$variable <- factor(df.mut$variable, levels=unique(df.mut$variable))
png(file="IMAGES/test1.png")
print(
ggplot(df.mut, aes(x="")) +
facet_grid(variable~., scales="free_y") +
geom_bar(data=subset(df.mut, variable=='HLA.A11.A24'),
aes(x='0', y=Avrg.muts.HLA.A11.A24, fill=value), width = 1, stat = "identity") +
geom_bar(data=subset(df.mut, variable=='HLA.A11'),
aes(x='1', y=Avrg.muts.HLA.A11, fill=value), width = 1, stat = "identity") +
geom_bar(data=subset(df.mut, variable=='HLA.A24'),
aes(x='2', y=Avrg.muts.HLA.A24, fill=value), width = 1, stat = "identity") +
ggtitle("TEST1") +
theme(axis.text.x=element_blank(), legend.title=element_blank(), legend.position="right", legend.background=element_blank(), legend.box.just="left", plot.title=element_text(size=15, face="bold", colour="black", vjust=1.5)) +
scale_y_continuous(name="") +
scale_x_discrete(name="") +
coord_polar(theta="y")
)
dev.off()
This produces the following image:
However, when I try to having the 3 of them together, the best I get is this mess:
How can I combine the pie charts above? And include numbers.