pie
Legacy pie chart
Description
Note
piechart
is recommended over pie
because it enables you to create a
PieChart
object, which provides more customization options. For
example, PieChart
objects have properties for changing the slice
colors, the arrangement of the slices around the circle (clockwise or
counterclockwise), and the location of the first slice. (since R2023b)
pie(
draws a pie chart using the data
in X
)X
. Each slice of the pie chart represents an element in
X
.
If
sum(X) ≤ 1
, then the values inX
directly specify the areas of the pie slices.pie
draws only a partial pie ifsum(X) < 1
.If
sum(X) > 1
, thenpie
normalizes the values byX/sum(X)
to determine the area of each slice of the pie.If
X
is of data typecategorical
, the slices correspond to categories. The area of each slice is the number of elements in the category divided by the number of elements inX
.
pie(
offsets
slices from the pie. X
,explode
)explode
is a vector or matrix
of zeros and nonzeros that correspond to X
. The pie
function
offsets slices for the nonzero elements only in explode
.
If X
is of data type categorical
,
then explode
can be a vector of zeros and nonzeros
corresponding to categories, or a cell array of the names of categories
to offset.