| 1 |
% Manual of pgf-pie.sty, a convenient set of macros for drawing pie |
| 2 |
% chart. Written by Xu Yuan <[email protected]> This file is part of |
| 3 |
% pgf-pie you may get it at https://github.com/pgf-tikz/pgf-pie |
| 4 |
|
| 5 |
\PassOptionsToPackage{% |
| 6 |
colorlinks=true, |
| 7 |
linkcolor=blue, |
| 8 |
anchorcolor=black, |
| 9 |
citecolor=olive, |
| 10 |
filecolor=magenta, |
| 11 |
menucolor=red, |
| 12 |
urlcolor=blue |
| 13 |
}{hyperref} |
| 14 |
\documentclass{ltxdoc} |
| 15 |
|
| 16 |
\usepackage{pgf-pie} |
| 17 |
\usetikzlibrary{babel, shadows} |
| 18 |
|
| 19 |
\usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead]{geometry} |
| 20 |
\usepackage{calc} |
| 21 |
\usepackage{graphicx} |
| 22 |
\input{pgfmanual-en-macros.tex} |
| 23 |
|
| 24 |
\pgfqkeys{/codeexample}{% |
| 25 |
scale/.store in=\pgfpieexamplescale, |
| 26 |
scale=1, |
| 27 |
every codeexample/.style={% |
| 28 |
width=.4\textwidth+7pt, |
| 29 |
pre={ |
| 30 |
\setbox\codeexamplebox=\hbox\bgroup |
| 31 |
}, |
| 32 |
post={ |
| 33 |
\egroup |
| 34 |
\resizebox{\pgfpieexamplescale\textwidth}{!}{\box\codeexamplebox}% |
| 35 |
}, |
| 36 |
}, |
| 37 |
} |
| 38 |
|
| 39 |
\newcommand\pgfpiename{\texttt{pgf-pie}} |
| 40 |
|
| 41 |
\begin{document} |
| 42 |
|
| 43 |
\title{Drawing Pie Chart by using \pgfpiename} |
| 44 |
\author{\href{mailto:[email protected]}{Yuan Xu}} |
| 45 |
\date{\today{}~(v0.7)} |
| 46 |
\maketitle |
| 47 |
|
| 48 |
\begin{abstract} |
| 49 |
\pgfpiename\ is a LaTeX package for drawing pie chart (and |
| 50 |
variant charts). As stated by its name, it is based on a very |
| 51 |
popular graphic package \pgfname/\tikzname. This document presents |
| 52 |
the usage of \pgfpiename\ and collects some pie charts as |
| 53 |
examples. \pgfpiename\ can be downloaded from |
| 54 |
\href{https://github.com/pgf-tikz/pgf-pie}{https://github.com/pgf-tikz/pgf-pie}. |
| 55 |
\end{abstract} |
| 56 |
|
| 57 |
\tableofcontents |
| 58 |
|
| 59 |
\section{Usage} |
| 60 |
|
| 61 |
\subsection{First Pie} |
| 62 |
|\pie| is the only command that provided by |
| 63 |
\pgfpiename. The argument is a list of number and text |
| 64 |
combination in the formate of |number/text|, i.e. |10/A, 20/B, 30/C, 40/D|. |
| 65 |
The result is shown in figure \ref{fig:first-pie}. |
| 66 |
\begin{figure} |
| 67 |
\centering |
| 68 |
\codeexample[scale=0.25,from file={demo/first-pie.tex}] |
| 69 |
\caption{The first pie.} |
| 70 |
\label{fig:first-pie} |
| 71 |
\end{figure} |
| 72 |
|
| 73 |
\subsection{Position, Rotation, Size} |
| 74 |
|
| 75 |
The center of chart can be set by |pos|, default is |
| 76 |
|{0,0}|. The chart can be rotated by setting |rotate| |
| 77 |
(in degrees). The size of chart can be set by |radius|, default |
| 78 |
is 3. |
| 79 |
|
| 80 |
\codeexample[scale=0.4,from file={demo/radius.tex}] |
| 81 |
|
| 82 |
\subsection{Color} |
| 83 |
The color can be specified by |color|, the default color wheel |
| 84 |
is shown in figure \ref{fig:color-wheel}. |
| 85 |
\begin{figure} |
| 86 |
\centering |
| 87 |
\input{demo/colorwheel} |
| 88 |
\caption{Default color wheel} |
| 89 |
\label{fig:color-wheel} |
| 90 |
\end{figure} |
| 91 |
|
| 92 |
\codeexample[scale=0.4,from file={demo/color.tex}] |
| 93 |
|
| 94 |
\subsection{Explode} |
| 95 |
\codeexample[scale=0.4,from file={demo/explode.tex}] |
| 96 |
|
| 97 |
\subsection{Angle of slices} |
| 98 |
The value of |sum| indicates the sum of all data in the chart, |
| 99 |
it is 100 by default. It can be calculated automatically when |
| 100 |
|auto| is set. Then the angle of slices are determined by |
| 101 |
number value and |sum|. |
| 102 |
|
| 103 |
\codeexample[scale=0.4,from file={demo/sum.tex}] |
| 104 |
|
| 105 |
\subsection{Slice order} |
| 106 |
The slices order direction can be set to clockwise by setting |change direction|, default is counterclockwise. |
| 107 |
|
| 108 |
\codeexample[scale=0.4,from file={demo/change-direction.tex}] |
| 109 |
|
| 110 |
\subsection{Text} |
| 111 |
|
| 112 |
\subsubsection{Number} |
| 113 |
Two parameters can be used to decorate number: |before number| |
| 114 |
and |after number|. Both are empty by default, but if |
| 115 |
|sum=100|, |after number| will be set to \% |
| 116 |
automatically if user doesn't set it. |
| 117 |
|
| 118 |
\codeexample[scale=0.25,from file={demo/before-after-number.tex}] |
| 119 |
|
| 120 |
The number also can be hide by |hide number|: |
| 121 |
|
| 122 |
\codeexample[scale=0.25,from file={demo/hide-number.tex}] |
| 123 |
|
| 124 |
\paragraph{Scale font} |
| 125 |
The size of font in size pie can be scaled according to how big the |
| 126 |
part is automatically. |
| 127 |
|
| 128 |
\codeexample[scale=0.25,from file={demo/scalefont.tex}] |
| 129 |
|
| 130 |
\subsubsection{Label text} |
| 131 |
The value of |text| can be |label| (default), |
| 132 |
|pin|, |inside| or |legend|. |
| 133 |
|
| 134 |
\codeexample[scale=0.25,from file={demo/text.tex}] |
| 135 |
|
| 136 |
\codeexample[scale=0.25,from file={demo/text-inside.tex}] |
| 137 |
|
| 138 |
\codeexample[scale=0.25,from file={demo/legend.tex}] |
| 139 |
|
| 140 |
\subsection{More about style} |
| 141 |
\subsubsection{shadow} |
| 142 |
\codeexample[scale=0.25,from file={demo/shadow.tex}] |
| 143 |
|
| 144 |
\section{Variant Charts} |
| 145 |
\subsection{Polar area diagram} |
| 146 |
The polar area diagram is similar to a usual pie chart, except sectors |
| 147 |
are equal angles and differ rather in how far each sector extends from |
| 148 |
the center of the circle. |
| 149 |
|
| 150 |
\codeexample[scale=0.25,from file={demo/polar.tex}] |
| 151 |
|
| 152 |
\subsection{Square} |
| 153 |
|
| 154 |
\codeexample[scale=0.25,from file={demo/square.tex}] |
| 155 |
|
| 156 |
Note: |explode| has no affects in square chart. |
| 157 |
|
| 158 |
\subsection{Clouds} |
| 159 |
|
| 160 |
\codeexample[scale=0.25,from file={demo/cloud.tex}] |
| 161 |
|
| 162 |
\section{Examples} |
| 163 |
|
| 164 |
% \subsection{Population of the world} |
| 165 |
% \example{population} |
| 166 |
|
| 167 |
\section{Acknowledgements} |
| 168 |
Many people contributed to \pgfpiename\ by reporting problems, |
| 169 |
suggesting various improvements or submitting code. Here is a list of |
| 170 |
these people: |
| 171 |
\href{mailto:[email protected]}{Mohammed Alfaki}, |
| 172 |
and |
| 173 |
\href{mailto:[email protected]}{Lukas Drude} |
| 174 |
. |
| 175 |
|
| 176 |
\end{document} |
| 177 |
%%% Local Variables: |
| 178 |
%%% mode: Tex-PDF |
| 179 |
%%% TeX-master: t |
| 180 |
%%% End: |