I am making a pie chart to go along with a series of plots all made in ggplot2. The data I'm using have two categories broken in to a total of three subcategories. Basically, the data look like this:
Category Category_Value Super_Category
<fctr> <dbl> <dbl>
1 A 0.03733874 1
2 B 0.66732754 0
3 C 0.29533372 1
Here is the basic pie chart I have at the subcategory level:
And here is what I'd like to have (or something similar):
I had never made a pie chart in ggplot2 before, so here is my basic code to generate the top plot:
pie.chart <- ggplot(pie.data, aes(x = "", y = Category_Value, fill = Category, width = 1)) +
geom_bar(width = 1, stat = "identity") +
coord_polar("y", start = 0) +
scale_fill_manual(values = c("#4DAF4A", "#377EB8", "#E41A1C")) +
theme_bw() +
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank(),
panel.border = element_blank(),
panel.grid = element_blank(),
axis.ticks = element_blank()
)
Is this something that's doable? I messed around with making another plot grouped at the major category level and overlaying them without success.