Function:
PieChart - produce a pie chart from data
Calling sequence:
PieChart(L, options);
Parameters:
L
- a list, or one-dimensional array or Array, of positive numbers
options
- many of the usual two-dimensional plot options, plus
explode = E
, where
E
is an integer or a list of positive integers.
Description:
-
This procedure produces a pie chart. Each member of
L
corresponds to a slice of the circular pie, subtending an angle corresponding to that member's fraction of the total.
-
The slices go clockwise around the pie, starting at the top.
-
If the option
explode=E
is used, each slice whose position in
L
is a member of the list
E
will be exploded, i.e. moved some distance out from the centre of the pie. Thus
explode=[2,4]
causes the second and fourth slices to be exploded. Any members of
E
that are not positions in
L
have no effect.
-
If the option
labels = B
is used, each slice is labelled (outside the circumference) by one of the entries of the list
B
. An error results if there are too few labels for the items. If there are more labels than items, the extra labels have no effect.
-
If the option
colour = L
is used, where
L
is a list, then each slice is coloured with a colour from the list
L
. Colours may be specified by predefined names (e.g.
red
or
tan
), RGB, HSV or HUE values (e.g. COLOUR(RGB,0,1,0.5) or COLOUR(HUE,0.4). An error results if there are more items than colours. If there are more colours than items, the extra colours have no effect. If there is no
colour
option, colours are evenly spaced in HUE between 0 and 1. You may use
color
,
colours
or
colors
instead of
colour
.
-
This procedure is part of the Maple Advisor Database.
Examples:
A simple pie chart.
>
PieChart([3,1,4,1,5]);
The same data, with specified colours and labels and the first slice exploded..
>
PieChart([3,1,4,1,5],colour=[red,yellow,green,blue,magenta],labels=["A","B","C","D","E"],explode=[1]);