| Contents | Index |
creates a 2D pie chart with pieces of size ratios
.
creates a corresponding 3D pie chart.
Calls:
plot::Piechart2d([d1, d2, ...], <a = amin .. amax>, Options)
plot::Piechart2d(A, <a = amin .. amax>, Options)
plot::Piechart3d([d1, d2, ...], <a = amin .. amax>, Options)
plot::Piechart3d(A, <a = amin .. amax>, Options)
Parameters:
|
d1, d2, ...: |
the sizes of the pieces: non-negative real values or arithmetical expressions of the animation parameter a. |
|
A: |
See Also:
plot, plot::Bars2d, plot::Bars3d, plot::Boxplot, plot::copy, plot::Histogram2d, plot::Matrixplot
Details:
With the input data d1, d2 etc., the
-th piece of the pie has the opening angle
.
The attribute Titles allows to attach titles to the pieces of the pie. In contrast to the overall title of the pie chart (Title, TitleFont), the titles of the pieces react to TextFont.
The attribute Moves allows to move the pieces away from the pie center for highlighting.
In 3D, the attribute Heights allows to vary the heights of the pieces.
The attributes Center and Radius allow to position and scale a pie chart relative to other graphical objecs in the same scene.
Example 1
We create a 2D pie chart with pieces of the size ratios
.
p := plot::Piechart2d([1, 2, 1, 3, 2.5]):
plot(p)

We set titles for the pieces:
p::Titles := ["10.5%", "21.1%", "10.5%", "31.6%", "26.3%"]:
plot(p)

Pieces can be moved away from the pie center with the attribute Moves. One or more moves can be given as a list of values
. The “move factors” f1, f2 etc. are positive real values that represent fractions of the pie radius. The
-th piece is moved away from the center by fi. If not all pieces are to be, one may specify Moves =
, such that only the pieces with indices n1, n2 etc. are moved:
p::Moves := [1 = 0.3, 3 = 0.5]:
plot(p)

delete p:
Example 2
We create a 3D pie chart with pieces of the size ratios
.
p := plot::Piechart3d([1, 2, 1, 3, 2.5]):
plot(p)

We set titles for the pieces:
p::Titles := ["10.5%", "21.1%", "10.5%", "31.6%", "26.3%"]:
plot(p)

Some pieces are moved away from the center:
p::Moves := [1 = 0.3, 3 = 0.5]:
plot(p)

The heights of the pieces in a 3D pie chart can vary:
p::Heights := [0.1, 0.2, 0.1, 0.3, 0.25]:
plot(p)

delete p:
Example 3
A pie chart can be animated. We plot a pie chart with an animated radius. The pieces move in and out, changing their size:
m1 := piecewise([abs(a - PI/4) <= PI/4, sin(2*a)^2/3],
[abs(a - PI/4) > PI/4, 0]):
m2 := piecewise([abs(a - 3*PI/4) <= PI/4, sin(2*a)^2/3],
[abs(a - 3*PI/4) > PI/4, 0]):
m3 := piecewise([abs(a - 5*PI/4) <= PI/4, sin(2*a)^2/3],
[abs(a - 5*PI/4) > PI/4, 0]):
m4 := piecewise([abs(a - 7*PI/4) <= PI/4, sin(2*a)^2/3],
[abs(a - 7*PI/4) > PI/4, 0]):
p := plot::Piechart3d([5 + sin(a)/4, 2, 1 + sin(a)/2, 4],
Title = "crazy pie chart",
TitlePosition = [0, 15, 5],
TitleFont = [Italic, 18],
Center = [0, 0, 0],
Radius = 10 + sin(2*a),
Heights = [1.5 + sin(a), 1.5 + cos(2*a),
1.5 + sin(a), 1.5 + cos(4*a)],
Titles = [1 = "piece 1", 2 = "piece 2",
3 = "piece 3", 4 = "piece 4"],
Moves = [m1, m2, m3, m4],
a = 0..2*PI):
plot(p):


delete m1, m2, m3, m4, p:

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |