Pie Chart for Count Data

Example Data 244 238 1
The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Pie Charts


Draw a pie chart.


pie(x, labels = names(x), edges = 200, radius = 0.8,
    clockwise = FALSE, init.angle = if(clockwise) 90 else 0,
    density = NULL, angle = 45, col = NULL, border = NULL,
    lty = NULL, main = NULL, ...)



a vector of non-negative numerical quantities. The values in x are displayed as the areas of pie slices.


one or more expressions or character strings giving names for the slices. Other objects are coerced by as.graphicsAnnot. For empty or NA (after coercion to character) labels, no label nor pointing line is drawn.


the circular outline of the pie is approximated by a polygon with this many edges.


the pie is drawn centered in a square box whose sides range from -1 to 1. If the character strings labeling the slices are long it may be necessary to use a smaller radius.


logical indicating if slices are drawn clockwise or counter clockwise (i.e., mathematically positive direction), the latter is default.


number specifying the starting angle (in degrees) for the slices. Defaults to 0 (i.e., ‘3 o'clock’) unless clockwise is true where init.angle defaults to 90 (degrees), (i.e., ‘12 o'clock’).


the density of shading lines, in lines per inch. The default value of NULL means that no shading lines are drawn. Non-positive values of density also inhibit the drawing of shading lines.


the slope of shading lines, given as an angle in degrees (counter-clockwise).


a vector of colors to be used in filling or shading the slices. If missing a set of 6 pastel colours is used, unless density is specified when par("fg") is used.

border, lty

(possibly vectors) arguments passed to polygon which draws each slice.


an overall title for the plot.


graphical parameters can be given as arguments to pie. They will affect the main title and labels only.


Pie charts are a very bad way of displaying information. The eye is good at judging linear measures and bad at judging relative areas. A bar chart or dot chart is a preferable way of displaying this type of data.

Cleveland (1985), page 264: “Data that can be shown by pie charts always can be shown by a dot chart. This means that judgements of position along a common scale can be made instead of the less accurate angle judgements.” This statement is based on the empirical investigations of Cleveland and McGill as well as investigations by perceptual psychologists.


Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

Cleveland, W. S. (1985) The Elements of Graphing Data. Wadsworth: Monterey, CA, USA.


pie(rep(1, 24), col = rainbow(24), radius = 0.9)

pie.sales <- c(0.12, 0.3, 0.26, 0.16, 0.04, 0.12)
names(pie.sales) <- c("Blueberry", "Cherry",
    "Apple", "Boston Cream", "Other", "Vanilla Cream")
pie(pie.sales) # default colours
pie(pie.sales, col = c("purple", "violetred1", "green3",
                       "cornsilk", "cyan", "white"))
pie(pie.sales, col = gray(seq(0.4, 1.0, length = 6)))
pie(pie.sales, density = 10, angle = 15 + 10 * 1:6)
pie(pie.sales, clockwise = TRUE, main = "pie(*, clockwise = TRUE)")
segments(0, 0, 0, 1, col = "red", lwd = 2)
text(0, 1, "init.angle = 90", col = "red")

n <- 200
pie(rep(1, n), labels = "", col = rainbow(n), border = NA,
    main = "pie(*, labels=\"\", col=rainbow(n), border=NA,..")

## Another case showing pie() is rather fun than science:
## (original by FinalBackwardsGlance on http://imgur.com/gallery/wWrpU4X)
pie(c(Sky = 78, "Sunny side of pyramid" = 17, "Shady side of pyramid" = 5),
    init.angle = 315, col = c("deepskyblue", "yellow", "yellow3"), border = FALSE)
R Output Dataset Referenced Date
Pie Chart for Count Data Example Data Jun 2, 2017
Pie Chart for Count Data email50 Jun 2, 2017
Pie Chart for Count Data Example Data Jun 2, 2017
Title Authored on Content type
R Dataset / Package Stat2Data / TipJoke March 9, 2018 - 1:06 PM Dataset
OpenIntro Statistics Dataset - fcid August 9, 2020 - 12:25 PM Dataset
heartTr June 12, 2017 - 10:27 AM Dataset
R Dataset / Package DAAG / toycars March 9, 2018 - 1:06 PM Dataset
R Dataset / Package Stat2Data / PigFeed March 9, 2018 - 1:06 PM Dataset