See other catalogues for
The MathWorks
You may also be interested in
Text version of the page
| | | | | | | | | | | | | | | | | | |
| | | |
| | | Pie Charts | | |
| | | |
| | | Pie Charts | | |
| | | |
| | | In this section... | | |
| | | |
| | | "Creating a Pie Chart" on page 5-23 "Labeling the Pie Chart" on page 5-24 "Removing a Piece from a Pie Chart" on page 5-26 | | |
| | | |
| | | Creating a Pie Chart Pie charts are a useful way to communicate the percentage that each element in a vector or matrix contributes to the sum of all elements. pie and pie3 create 2-D and 3-D pie charts. A 3-D pie chart does not show any more or different information than a 2-D pie chart does; it simply adds depth to the presentation by plotting the chart on top of a cylindrical base. This example shows how to use the pie function to visualize the contribution that three products make to total sales. Given a matrix X where each column of X contains yearly sales figures for a specific product over a five-year period, | | |
| | | |
| | | | | | | | | | | [19.3 | 22.1 | 51.6; | | | | 34.2 | 70.3 | 82.4; | | | | 61.4 | 82.9 | 90.8; | | | | 50.5 | 54.9 | 59.1; | | | | 29.4 | 36.3 | 47.0]; | | | | | | | | | | |
| | | |
| | | sum each row in X to calculate total sales for each product over the five-year period. x = sum(X); You can offset the slice of the pie that makes the greatest contribution using the explode input argument. This argument is a vector ofzero and nonzero values. Nonzero values offset the respective slice from the chart. First, create a vector containing zeros. explode = zeros(size(x)); | | |
| | | |
| | | 5-23 | | |
| | | |
| | | | | | | | | | | | | | | | | | |