I want to draw a multiple pie chart using R. I have data contains 3 levels of information, and I want to highlight information in the third level. For example, my sample size is 48, which is divided into 12 and 36 in the first level. Then, 12 is divided into 3 and 9 and 36 is divided into 24 and 12 in the second level. At the third level, the 3 is further divided into 1 and 2, and the 24 is further divided into 15 and 9. I want to present all the 3 levels of data but only need to highlight the division of the 3 and the 24.
I am thinking to draw a multiple pie chart to show it in R, but I do not know if R is able to do it. Since I need the percentage to be exact, I cannot use Photoshop to draw the chart.
If R cannot do it, I wonder what can I use to draw the chart? Any help would be appreciated. Thanks in advance!
2
Answers
Since you didn’t provide proper sample data, I’ll build a 2-step version of the 3-step data you described. I’ll leave it to you generalise.
Here’s the data (note that I divide the data into types and subtypes, and build a three-column dataset… your final version will be the same, but with a “C” type and some new subtypes):
And here’s how I do the pie chart with
ggplot2
package:Result:
I just found another answer, way simpler than
ggplot2
. Still assuming you have data like this:You can do:
The results are actually labelled correctly: