Saturday, June 9, 2012

Pie Chart --- three useful nodes defined by command "\psChart"

The macro \psChart defines for every value three nodes at the half angle and in distances from chartNodeI (default 0.75), 1 and chartNodeO(default 1.25) times of the radius from the origin (chartNodeI and chartNodeO will be discussed in the next post). The nodes are named as psChartInum, psChartnum and psChartOnum, where num is the number of the pie pieces (num have a value between 1 to the numbers of pie pieces, Letter I stands for Inner and O stands for Outer). These nodes will be very usefull when you add labels to the pie pieces. The following shows these nodes visually.


Fig.1 Three useful nodes defined by command \psChart.

Files Downloads: tex ps pdf

Now a practical example of plotting a pie chart will be presented.


Fig.2 A practical example of pie chart plotting.

In this example, we put the labels using the nodes which have been defined by "\psChart".

Files Downloads: tex ps pdf

Sunday, June 3, 2012

Pie chart --- the simplest use of command "\psChart"

Command "\psChart" in package pstricks-add makes plot a pie chart very simple. The syntax of this command is "\psChart[options]{values1}{values2}{radius}". "values1" is the list of date to be plotted. "vaules2" is a list of outraged pieces. For example, if you want the 1st and 5-th sector to be outraged, you can specify this parameter as "{1,5}". "radius" is the radius of the pie chart. The color used to paint the num-th pie piece is named internally as "chartFillColornum".

Now let us have a try of this command.

    %Pie chart
    %The legends
    \uput[r](6.5,-4.75){Pie 1}
    \uput[r](6.5,-3.75){Pie 2}
    \uput[r](6.5,-2.75){Pie 3}
    \uput[r](6.5,-1.75){Pie 4}
    \uput[r](6.5,-0.75){Pie 5}
    \uput[r](6.5,0.25){Pie 6}

Fig.1 Pie chart plots in Pstricks

In the upper example, we see that a pie chart with radius "5" is plotted accroding to data "{1,2,2,3,1,4}", and the 1-st and 5-th pie pieces is outraged. This is exactly what we expected. And with the help of variable "chartFillColornum" we produced the legends.

Files Downloads: tex ps pdf
Creative Commons License
Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.