Skip to Main Content Skip to Search
Product Documentation

pie3 - 3-D pie chart

Example of pie3 function output

Alternatives

To graph selected variables, use the Plot Selector in the Workspace Browser, or use the Figure Palette Plot Catalog. Manipulate graphs in plot edit mode with the Property Editor. For details, see Plotting Tools — Interactive Plotting in the MATLAB Graphics documentation and Creating Graphics from the Workspace Browser in the MATLAB Desktop Tools documentation.

Syntax

pie3(X)
pie3(X,explode)
pie3(...,labels)
pie3(axes_handle,...)
h = pie3(...)

Description

pie3(X) draws a three-dimensional pie chart using the data in X. Each element in X is represented as a slice in the pie chart.

pie3(X,explode) specifies whether to offset a slice from the center of the pie chart. X(i,j) is offset from the center of the pie chart if explode(i,j) is nonzero. explode must be the same size as X.

pie3(...,labels) specifies text labels for the slices. The number of labels must equal the number of elements in X. For example,

pie3(1:3,{'Taxes','Expenses','Profit'})

pie3(axes_handle,...) plots into the axes with the handle axes_handle instead of into the current axes (gca).

h = pie3(...) returns a vector of handles to patch, surface, and text graphics objects.

Tips

The values in X are normalized via X/sum(X) to determine the area of each slice of the pie. If sum(X) ≤ 1, the values in X directly specify the area of the pie slices. MATLAB draws only a partial pie if sum(X) < 1.

Examples

Offset a slice in the pie chart by setting the corresponding explode element to 1:

x = [1 3 0.5 2.5 2];
explode = [0 1 0 0 0];
pie3(x,explode)
colormap hsv

See Also

pie

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS