I try to label my pie chart using geom_label_repel()
from the ggrepel
package but it wouldn't work. The color of the pie was disappeared.
My script:
ggplot(HumanBittingRates,
aes(x=factor(1), y = HBRs.Per.Person.Per.Night, fill = factor(Type))) +
geom_bar(width = 1, stat = "identity", position = "fill") +
facet_wrap(~Area) +
coord_polar(theta = "y")
But when I add a label
ggplot(HumanBittingRates,
aes(x=factor(1), y = HBRs.Per.Person.Per.Night, fill = factor(Type))) +
geom_bar(width = 1, stat = "identity", position = "fill") +
facet_wrap(~Area) +
coord_polar(theta = "y") +
geom_label_repel(aes(y = HBRs.Per.Person.Per.Night, label = Lable),
size = 2, show.legend = F, nudge_x = 1)
the plot looks like this:
My data:
Area Type HBRs Per Person Per Night Lable
Biron Badala An. gambiaes.l. 17.92 85.25%
Biron Badala An. nili 2.1 9.99%
Biron Badala An. coustani 0.57 2.71%
Biron Badala An. funestus 0.43 2.05%
Cisse An. gambiaes.l. 27.81 98.58%
Cisse An. nili 0.06 0.21%
Cisse An. coustani 0.27 0.96%
Cisse An. funestus 0.07 0.25%
Kamadena An. gambiaes.l. 21.6 96.69%
Kamadena An. nili 0.29 1.30%
Kamadena An. coustani 0.35 1.57%
Kamadena An. funestus 0.1 0.45%
Kodougou An. gambiaes.l. 21.56 92.14%
Kodougou An. nili 1.31 5.60%
Kodougou An. coustani 0.41 1.75%
Kodougou An. funestus 0.12 0.51%
Konkuini An. gambiaes.l. 22.42 97.99%
Konkuini An. nili 0.04 0.17%
Konkuini An. coustani 0.32 1.40%
Konkuini An. funestus 0.1 0.44%
Labarani An. gambiaes.l. 22.63 95.36%
Labarani An. nili 0.74 3.12%
Labarani An. coustani 0.33 1.39%
Labarani An. funestus 0.03 0.13%
Thanks for your help!!