Navigation

Operators and Keywords

Function List:

C++ API

: pie3 (x)
: pie3 (…, explode)
: pie3 (…, labels)
: pie3 (hax, …);
: h = pie3 (…);

Plot a 3-D pie chart.

Called with a single vector argument, produces a 3-D pie chart of the elements in x. The size of the ith slice is the percentage that the element xi represents of the total sum of x: pct = x(i) / sum (x).

The optional input explode is a vector of the same length as x that, if nonzero, "explodes" the slice from the pie chart.

The optional input labels is a cell array of strings of the same length as x specifying the label for each slice.

If the first argument hax is an axes handle, then plot into this axis, rather than the current axes returned by gca.

The optional return value h is a list of graphics handles to the patch, surface, and text objects generating the plot.

Note: If sum (x) ≤ 1 then the elements of x are interpreted as percentages directly and are not normalized by sum (x). Furthermore, if the sum is less than 1 then there will be a missing slice in the pie plot to represent the missing, unspecified percentage.

See also: pie, bar, hist, rose.

Demonstration 1

The following code

 clf;
 pie3 ([5:-1:1], [0, 0, 1, 0, 0]);
 colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
 title ("pie3() with exploded wedge");

Produces the following figure

Figure 1

Demonstration 2

The following code

 clf;
 pie3 ([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]);
 title ("pie3() with labels");

Produces the following figure

Figure 1

Demonstration 3

The following code

 clf;
 pie3 ([0.17, 0.34, 0.41], {"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]);
 title ("pie3() with missing slice");

Produces the following figure

Figure 1

Package: octave