Reputation: 8247
I have following dataframe in r
Equipment Area Count
RTG 1 12
RTG 2 13
STS 1 34
STS 2 33
RTG 3 22
STS 3 21
I want to draw faceted pie chart with equipment and count nos inside the pie chart.
I am using following code in R
ggplot(data = test) +
geom_bar(aes(x = "", y = Count, fill = Area),
stat = "identity") +
geom_text(aes(x = "", y = Count, label = count),position =
position_fill(width=1))+
coord_polar(theta = "y") +
facet_grid(Equipment ~ ., scales = "free")
But,it does not produce any graph.
Upvotes: 0
Views: 788
Reputation: 3026
ggplot(data = test, aes(x = "", y = Count, fill = Area)) +
geom_bar(stat = "identity") +
geom_text(aes(label = Count), position = position_stack(vjust = 0.5)) +
coord_polar(theta = "y") +
facet_grid(Equipment ~ ., scales = "free")
Upvotes: 1