Draw a pie chart
You want to draw a pie chart
Solution: It is generally recommended to avoid presenting data as pie charts (see the book by Tufte for arguments why most pie charts are a bad idea).
pie function in R can be used to generate
pie charts. Its first argument should be a vector of values that
are used to define the relative size of the individual slices of
the pie. Additional arguments are
label which are vectors that set the colors and
labels of the individual slices, respectively. Normally, the
first cut of the first slice is along the x-axis, but we can
change that with the
init.angle argument as shown
> pie(c(20, 80), init.angle=-40, + col=c("black", "yellow"), + label=c("Does not\nresemble\nPac-man", "Resembles Pac-man"))
The R code produces the pie plot shown below.
Back to tips.