11 Pie plots

class pie_plot.T
Pie plots. Image pietest

Sample pie chart

Below is the source code that produces the above chart. /home/ysaito/pychart/demos/pietest.py

from pychart import *

import sys
data = [("foo", 10),("bar", 20), ("baz", 30), ("ao", 40)]

ar = area.T(size=(150,150), legend=legend.T(),
            x_grid_style = None, y_grid_style = None)

plot = pie_plot.T(data=data, arc_offsets=[0,10,0,10],
                  shadow = (2, -2, fill_style.gray50),
                  label_offset = 25,
                  arrow_style = arrow.a3)
ar.add_plot(plot)
ar.draw()

This class supports the following attributes:

arc_offsets
Type: list Default: None.

You can draw each pie "slice" shifted off-center. This attribute, if non-None, must be a number sequence whose length is equal to the number of pie slices. The Nth value in arc_offsets specify the amount of offset (from the center of the circle) for the Nth slice. The value of None will draw all the slices anchored at the center.

arrow_style
Type: arrow.T ( see Section 19) Default: None.

The style of arrow that connects a label to the corresponding "pie".

center
Type: (x,y) Default: None.

The location of the center of the pie.

data
Type: any Default: None.

Specifies the data points. See Section 5

data_col
Type: int Default: 1.

The column, within "data", from which the data values are retrieved.

fill_styles
Type: list Default: ['fill_style.black', 'fill_style.gray70', 'fill_style.diag', 'fill_style.gray50', 'fill_style.vert', 'fill_style.rdiag', 'fill_style.white', 'fill_style.gray30', 'fill_style.gray20', 'fill_style.gray10', 'fill_style.diag2', 'fill_style.rdiag2', 'fill_style.diag3', 'fill_style.horiz', 'fill_style.gray90', 'fill_style.rdiag3', 'fill_style.wave', 'fill_style.vwave', 'fill_style.stitch', 'fill_style.lines', 'fill_style.diag_fine', 'fill_style.diag2_fine', 'fill_style.diag3_fine', 'fill_style.rdiag_fine', 'fill_style.rdiag2_fine', 'fill_style.rdiag3_fine', 'fill_style.horiz_fine', 'fill_style.vert_fine'].

The fill style of each item. The length of the list should be equal to the length of the data.

label_col
Type: int Default: 0.

The column, within "data", from which the labels of items are retrieved.

label_fill_style
Type: fill_style.T ( see Section 16) Default: fill_style.default.

The fill style of the frame surrounding each label.

label_format
Type: printf format string Default: "%s".

Format string of the label

label_line_style
Type: line_style.T ( see Section 14) Default: None.

The style of the frame surrounding each label.

label_offset
Type: length in points (
xrefunit) Default: None.

The distance from the center of each label.

line_style
Type: line_style.T ( see Section 14) Default: line_style.black.

The style of the outer edge of each pie slice.

radius
Type: length in points (
xrefunit) Default: None.

The radius of the pie.

shadow
Type: (xoff,yoff,fill) Default: None.

The value is either None or a tuple. When non-None, a drop-shadow is drawn beneath the object. X-off, and y-off specifies the offset of the shadow relative to the object, and fill specifies the style of the shadow ( see Section 16).

start_angle
Type: number Default: 90.

The angle at which the first item is drawn.