Produce a pie chart.
Called with a single vector arrgument, produces a pie chart of the elements in x, with the size of the slice determined by percentage size of the values of x.
The variable explode is a vector of the same length as x that if non zero 'explodes' the slice from the pie chart.
If given labels is a cell array of strings of the same length as x, giving the labels of each of the slices of the pie chart.
The optional return value h provides a handle to the patch object.
The following code
pie ([3, 2, 1], [0, 0, 1]); colormap([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
Produces the following figure
![]() |
The following code
pie ([3, 2, 1], [0, 0, 1], {"Cheddar", "Swiss", "Camembert"}); colormap([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]); axis ([-2,2,-2,2]);
Produces the following figure
![]() |