A pie chart is a circle divided into
sectors that each represent a proportion of the whole. This page
explains how to build one with basic
R natively offers the
pie() function that
builds pie charts. The input is just a numeric variable, each value
providing the value of a group of the piechart.
Important note: pie chart are widely known as a bad way to visualize information. Check this post for reasons and alternatives.
Provide a vector of labels to the
labels argument to
add names to piechart groups:
Decrease the value of the
edges argument to get angles
around your piechart.
# If you give a low value to the "edge" argument, you go from something circular to a shape with edges pie(Prop , labels = c("Gr-A","Gr-B","Gr-C","Gr-D","Gr-E") , edges=10)
density arguments adds stripes.
You can control the angle of those stripes with
# The density arguments adds stripes. You can control the angle of this lines with "angle" pie(Prop , labels = c("Gr-A","Gr-B","Gr-C","Gr-D","Gr-E") , density=10 , angle=c(20,90,30,10,0))
Change group color with
col, and border color with
RcolorBrewer package is used to build a nice