pie(x, names = NULL, explode = F, style.pie = list(), size = .75,
inner = .3, outer = 1.1, angle = <<see below>>,
density = <<see below>>, col = 1:12, rotate = T, ...)
ith slice will take the fraction
abs(x[i])/sum(abs(x)) of the pie.
The slices start with a horizontal line to the right and go counter-clockwise.
Missing values are not accepted.
inner,
outer, and
rotate). For compatibility with R, both
names and
labels are supported and used interchangably. If both
names and
labels are used in the argument list for
pie, a warning message is displayed and
labels is used.
x, it is reused cyclically.
pie." to get the name of a dataset which is a list. Component
names of this list should match the names of the parameters below; the
component values serve as the defaults for the corresponding
parameters (i.e., other arguments supplied to the function
override the
style.pie component values). Standard
style.pie option values
include
"splus" and
"old".
.3 means that labels can go no
further toward the center than .3 of the radius.
45 if
density is supplied.)
5 if
angle is supplied.
A density of
0 implies solid filling, and is the default if
col has more than one color and
angle is not supplied.
Negative values of density produce no shading which is the default if
col has only one color and
angle is not supplied.
col is supplied and neither
angle nor
density are given
as arguments, slices will be filled solidly or unfilled. In this case,
if there is only one color specified, the slices will be unfilled.
Otherwise, they will be filled solidly. Note, the special value,
NA,
can be used to indicate that the current
par("col")
value is to be used for the fill or shading color.
TRUE,
names are drawn parallel to the center line
of each slice.
If
FALSE,
names are drawn horizontally. This is convenient if the
graphics device has a limited capability for character rotation.
Solid filling of pie slices is dependent on the area-filling capability
of the device driver. For devices without explicit area-filling capability,
solid filling can be simulated by specifying a very high density shading.
The default options are geared towards devices that have color
or halftoning capabilities, such as
motif and
postscript.
Specifying
style="old" will set the defaults to produce a pie chart
with unfilled slices drawn with the current
par("col") value.
Pie charts are most useful when the emphasis is on individual item's relation to the total. When such an emphasis is not the primary point of the graphic, a bar chart or a dot chart is preferred.
Cleveland, W. S. (1985). The Elements of Graphing Data. Wadsworth, Monterey, California.
# create a plot from one student's testscores
datest <- (testscores[18,])
name <- attributes(datest)
pie(datest, names = name, col = c(3:7))
# explode testscores < 20 percent
pie(datest, names = name, col = c(3:7), explode = datest < 20)
# force the labels to be outside the chart
pie(datest, names = name, col = c(3:7), explode = datest < 20,
inner = .95)
# pie chart created with a user defined style
pie.mystyle <- list(col=1:100, inner=1.1, rotate=F)
pie(revenues, names=revenue.class, style.pie="mystyle")
datatel <- apply(telsam.response, 2, sum)
pie(datatel, dimnames(telsam.response)[[2]], explode = c(T, F, F, F),
col = c(3:6))
title(main =
"Response to Quality of Service Questions\nConcerning Telephone Service")