pie()
In this page:
pie()
pie(values) draws a pie chart from a vector of values, showing each as a proportional slice of the whole. Pie charts are best used sparingly and only for a small number of categories, since comparing slice angles is harder for viewers than comparing bar heights. labels sets the text shown next to each slice.
Note: For more than a handful of categories, prefer barplot() over pie() -- proportions are much easier to compare as bar heights.
Example: pie()
shares <- c(Product_A = 40, Product_B = 35, Product_C = 25)
print(shares)
cat("pie(shares) would draw a pie chart with these three proportional slices\n")
Login to try C/C++/Java/PHP code in the editor
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: