Updates from Overleaf

This commit is contained in:
Radim Lipovčan 2019-03-02 22:50:23 +01:00
parent 7b688ad501
commit 0afb360f11

View File

@ -1,439 +1,439 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Start of pgf-pie.sty % Start of pgf-pie.sty
% %
% Some LaTeX macros for pie chart by using PGF/Tikz package. % Some LaTeX macros for pie chart by using PGF/Tikz package.
% Home page of project: http://pgf-pie.googlecode.com/ % Home page of project: http://pgf-pie.googlecode.com/
% Author: Xu Yuan <xuyuan.cn@gmail.com> % Author: Xu Yuan <xuyuan.cn@gmail.com>
% %
\NeedsTeXFormat{LaTeX2e}[1999/12/01] \NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{pgf-pie}[2011/10/02 v0.2 Some LaTeX macros for pie \ProvidesPackage{pgf-pie}[2011/10/02 v0.2 Some LaTeX macros for pie
chart by using PGF/Tikz package.] chart by using PGF/Tikz package.]
\RequirePackage{tikz} \RequirePackage{tikz}
\RequirePackage{ifthen} \RequirePackage{ifthen}
\RequirePackage{scalefnt} \RequirePackage{scalefnt}
% args: % args:
% #1: begin angle % #1: begin angle
% #2: end angle % #2: end angle
% #3: number % #3: number
% #4: label % #4: label
% #5: explode % #5: explode
% #6: fill color % #6: fill color
% #7: radius % #7: radius
% #8: center % #8: center
\newcommand{\pgfpie@slice}[8]{ \newcommand{\pgfpie@slice}[8]{
\pgfmathparse{0.5*(#1)+0.5*(#2)} \pgfmathparse{0.5*(#1)+0.5*(#2)}
\let\midangle\pgfmathresult \let\midangle\pgfmathresult
\path (#8) -- ++(\midangle:#5) coordinate(O); \path (#8) -- ++(\midangle:#5) coordinate(O);
\pgfmathparse{#7+#5} \pgfmathparse{#7+#5}
\let\radius\pgfmathresult \let\radius\pgfmathresult
% slice % slice
\draw[line join=round, fill=#6, \style] (O) -- ++(#1:#7) arc (#1:#2:#7) -- cycle; \draw[line join=round, fill=#6, \style] (O) -- ++(#1:#7) arc (#1:#2:#7) -- cycle;
\pgfmathparse{min(((#2)-(#1)-10)/110*(-0.3),0)} \pgfmathparse{min(((#2)-(#1)-10)/110*(-0.3),0)}
\let\temp\pgfmathresult \let\temp\pgfmathresult
\pgfmathparse{(max(\temp,-0.5) + 0.8)*#7} \pgfmathparse{(max(\temp,-0.5) + 0.8)*#7}
\let\innerpos\pgfmathresult \let\innerpos\pgfmathresult
\ifthenelse{\equal{\pgfpie@text}{inside}} \ifthenelse{\equal{\pgfpie@text}{inside}}
{ {
% label and number together % label and number together
\path (O) -- ++(\midangle:\innerpos) node \path (O) -- ++(\midangle:\innerpos) node
{\scalefont{#3}\shortstack{#4\\\beforenumber#3\afternumber}}; {\scalefont{#3}\shortstack{#4\\\beforenumber#3\afternumber}};
} }
{ {
% label % label
\iflegend \iflegend
\else \else
\path (O) -- ++ (\midangle:\radius) \path (O) -- ++ (\midangle:\radius)
node[inner sep=0, \pgfpie@text=\midangle:#4]{}; node[inner sep=0, \pgfpie@text=\midangle:#4]{};
\fi \fi
% number % number
\path (O) -- ++(\midangle:\innerpos) node \path (O) -- ++(\midangle:\innerpos) node
{\scalefont{#3}\beforenumber#3\afternumber}; {\scalefont{#3}\beforenumber#3\afternumber};
} }
} }
\newcommand{\pgfpie@findColor}[1] \newcommand{\pgfpie@findColor}[1]
{ {
\pgfmathparse{int(mod(#1,\value{pgfpie@colorLength}))} \pgfmathparse{int(mod(#1,\value{pgfpie@colorLength}))}
\let\ci\pgfmathresult \let\ci\pgfmathresult
\foreach \c [count=\j from 0] in \color { \foreach \c [count=\j from 0] in \color {
\ifnum \j=\ci \ifnum \j=\ci
\xdef\thecolor{\c} \xdef\thecolor{\c}
\thecolor \thecolor
\breakforeach \breakforeach
\fi \fi
} }
} }
\newcommand{\pgfpie@findExplode}[1] \newcommand{\pgfpie@findExplode}[1]
{ {
\pgfmathparse{int(mod(#1,\value{pgfpie@explodeLength}))} \pgfmathparse{int(mod(#1,\value{pgfpie@explodeLength}))}
\let\ei\pgfmathresult \let\ei\pgfmathresult
\foreach \e [count=\j from 0] in \explode { \foreach \e [count=\j from 0] in \explode {
\ifnum \j=\ei \ifnum \j=\ei
\xdef\theexplode{\e} \xdef\theexplode{\e}
\breakforeach \breakforeach
\fi \fi
} }
} }
% #1: bottom left point % #1: bottom left point
% #2: size % #2: size
% #3: number % #3: number
% #4: color % #4: color
% #5: text % #5: text
\newcommand{\pgfpie@square}[5] \newcommand{\pgfpie@square}[5]
{ {
\ifthenelse{\equal{\pgfpie@text}{inside}} \ifthenelse{\equal{\pgfpie@text}{inside}}
{ {
\draw[fill=#4, \style] (#1) rectangle node \draw[fill=#4, \style] (#1) rectangle node
{\scalefont{#3}\shortstack{#5\\\beforenumber#3\afternumber}} ++(#2); {\scalefont{#3}\shortstack{#5\\\beforenumber#3\afternumber}} ++(#2);
} }
{ {
\draw[fill=#4, \style] (#1) rectangle node \draw[fill=#4, \style] (#1) rectangle node
{\scalefont{#3}\beforenumber#3\afternumber} ++(#2); {\scalefont{#3}\beforenumber#3\afternumber} ++(#2);
} }
} }
% #1: pos % #1: pos
% #2: radius % #2: radius
% #3: number % #3: number
% #4: color % #4: color
% $5: style % $5: style
% $6: label % $6: label
\newcommand{\pgfpie@cloud}[6] \newcommand{\pgfpie@cloud}[6]
{ {
\draw[fill=#4, #5] (#1) circle[radius=#2]; \draw[fill=#4, #5] (#1) circle[radius=#2];
\ifthenelse{\equal{\pgfpie@text}{inside}} \ifthenelse{\equal{\pgfpie@text}{inside}}
{ {
\node at (#1) {\scalefont{#3}\shortstack{#6\\\beforenumber#3\afternumber}}; \node at (#1) {\scalefont{#3}\shortstack{#6\\\beforenumber#3\afternumber}};
} }
{ {
\node at (#1) {\scalefont{#3}\beforenumber#3\afternumber}; \node at (#1) {\scalefont{#3}\beforenumber#3\afternumber};
} }
} }
\newlength{\pgfpie@angleEnd} \newlength{\pgfpie@angleEnd}
\newcounter{pgfpie@explodeLength} \newcounter{pgfpie@explodeLength}
\newcounter{pgfpie@colorLength} \newcounter{pgfpie@colorLength}
\newcounter{pgfpie@sliceLength} \newcounter{pgfpie@sliceLength}
\def\setexplode#1\pgfeov{\def\explode{#1}} \def\setexplode#1\pgfeov{\def\explode{#1}}
\pgfkeyslet{/explode/.@cmd}{\setexplode} \pgfkeyslet{/explode/.@cmd}{\setexplode}
\def\setcolor#1\pgfeov{\def\color{#1}} \def\setcolor#1\pgfeov{\def\color{#1}}
\pgfkeyslet{/color/.@cmd}{\setcolor} \pgfkeyslet{/color/.@cmd}{\setcolor}
\def\setradius#1\pgfeov{\def\radius{#1}} \def\setradius#1\pgfeov{\def\radius{#1}}
\pgfkeyslet{/radius/.@cmd}{\setradius} \pgfkeyslet{/radius/.@cmd}{\setradius}
\def\setpos#1\pgfeov{\def\pos{#1}} \def\setpos#1\pgfeov{\def\pos{#1}}
\pgfkeyslet{/pos/.@cmd}{\setpos} \pgfkeyslet{/pos/.@cmd}{\setpos}
\def\setstyle#1\pgfeov{\def\style{#1}} \def\setstyle#1\pgfeov{\def\style{#1}}
\pgfkeyslet{/style/.@cmd}{\setstyle} \pgfkeyslet{/style/.@cmd}{\setstyle}
\def\setbeforenumber#1\pgfeov{\def\beforenumber{#1}} \def\setbeforenumber#1\pgfeov{\def\beforenumber{#1}}
\pgfkeyslet{/before number/.@cmd}{\setbeforenumber} \pgfkeyslet{/before number/.@cmd}{\setbeforenumber}
\def\setafternumber#1\pgfeov{\def\afternumber{#1}} \def\setafternumber#1\pgfeov{\def\afternumber{#1}}
\pgfkeyslet{/after number/.@cmd}{\setafternumber} \pgfkeyslet{/after number/.@cmd}{\setafternumber}
\def\settext#1\pgfeov{\xdef\pgfpie@text{#1}} \def\settext#1\pgfeov{\xdef\pgfpie@text{#1}}
\pgfkeyslet{/text/.@cmd}{\settext} \pgfkeyslet{/text/.@cmd}{\settext}
\def\setsum#1\pgfeov{\xdef\pgfpie@sum{#1}} \def\setsum#1\pgfeov{\xdef\pgfpie@sum{#1}}
\pgfkeyslet{/sum/.@cmd}{\setsum} \pgfkeyslet{/sum/.@cmd}{\setsum}
\def\setrotate#1\pgfeov{\xdef\rotate{#1}} \def\setrotate#1\pgfeov{\xdef\rotate{#1}}
\pgfkeyslet{/rotate/.@cmd}{\setrotate} \pgfkeyslet{/rotate/.@cmd}{\setrotate}
\newif\ifpolar \newif\ifpolar
\pgfkeys{/polar/.is if=polar} \pgfkeys{/polar/.is if=polar}
\newif\iflegend \newif\iflegend
\newif\ifsquare \newif\ifsquare
\pgfkeys{/square/.is if=square} \pgfkeys{/square/.is if=square}
\newif\ifcloud \newif\ifcloud
\pgfkeys{/cloud/.is if=cloud} \pgfkeys{/cloud/.is if=cloud}
\newif\ifscalefont \newif\ifscalefont
\pgfkeys{/scale font/.is if=scalefont} \pgfkeys{/scale font/.is if=scalefont}
\let\scalefontorg\scalefont \let\scalefontorg\scalefont
\renewcommand{\scalefont}[1] \renewcommand{\scalefont}[1]
{ {
\ifscalefont \ifscalefont
\pgfmathparse{#1 / \pgfpie@sum * 3 + 0.9} \pgfmathparse{#1 / \pgfpie@sum * 3 + 0.9}
\scalefontorg{\pgfmathresult} \scalefontorg{\pgfmathresult}
\fi \fi
} }
\newcommand{\pie}[2][] \newcommand{\pie}[2][]
{ {
% load default parameters % load default parameters
\pgfkeys{ \pgfkeys{
explode=0, explode=0,
color={blue!60, cyan!60, yellow!60, orange!60, red!60, color={blue!60, cyan!60, yellow!60, orange!60, red!60,
blue!60!cyan!60, cyan!60!yellow!60, red!60!cyan!60, blue!60!cyan!60, cyan!60!yellow!60, red!60!cyan!60,
red!60!blue!60, orange!60!cyan!60}, red!60!blue!60, orange!60!cyan!60},
radius=3, radius=3,
pos={0,0}, pos={0,0},
style={thick}, style={thick},
before number=, before number=,
after number=, after number=,
text=label, text=label,
sum=100, sum=100,
rotate=0, rotate=0,
polar=false, polar=false,
square=false, square=false,
cloud=false, cloud=false,
scale font=false, scale font=false,
} }
% load user's parameters % load user's parameters
\pgfkeys{#1} \pgfkeys{#1}
% add percentage automatically % add percentage automatically
\ifthenelse{\equal{\pgfpie@sum}{100}} \ifthenelse{\equal{\pgfpie@sum}{100}}
{ {
\pgfkeys{after number=\%} \pgfkeys{after number=\%}
\pgfkeys{#1} \pgfkeys{#1}
}{} }{}
% legend or not % legend or not
\ifthenelse{\equal{\pgfpie@text}{legend}} \ifthenelse{\equal{\pgfpie@text}{legend}}
{\legendtrue} {\legendtrue}
{\legendfalse} {\legendfalse}
% handle sum % handle sum
\ifthenelse{\equal{\pgfpie@sum}{auto}} \ifthenelse{\equal{\pgfpie@sum}{auto}}
{ {
% sum all input % sum all input
\xdef\pgfpie@sum{0} \xdef\pgfpie@sum{0}
\foreach \p/\t in {#2} \foreach \p/\t in {#2}
{ {
\pgfmathparse{\pgfpie@sum + \p} \pgfmathparse{\pgfpie@sum + \p}
\xdef\pgfpie@sum{\pgfmathresult} \xdef\pgfpie@sum{\pgfmathresult}
} }
} }
{} {}
% init counters % init counters
\setcounter{pgfpie@explodeLength}{0} \setcounter{pgfpie@explodeLength}{0}
\foreach \e in \explode { \addtocounter{pgfpie@explodeLength}{1} } \foreach \e in \explode { \addtocounter{pgfpie@explodeLength}{1} }
\setcounter{pgfpie@colorLength}{0} \setcounter{pgfpie@colorLength}{0}
\foreach \c in \color { \addtocounter{pgfpie@colorLength}{1} } \foreach \c in \color { \addtocounter{pgfpie@colorLength}{1} }
\pgfmathsetlength{\pgfpie@angleEnd}{0} \pgfmathsetlength{\pgfpie@angleEnd}{0}
\setcounter{pgfpie@sliceLength}{0} \setcounter{pgfpie@sliceLength}{0}
\foreach \p/\e in {#2} { \addtocounter{pgfpie@sliceLength}{1} } \foreach \p/\e in {#2} { \addtocounter{pgfpie@sliceLength}{1} }
\ifsquare \ifsquare
%%%%%%%%%% SQUARE PIE BEGIN %%%%%%%%%%% %%%%%%%%%% SQUARE PIE BEGIN %%%%%%%%%%%
\pgfmathparse{\radius*2} \pgfmathparse{\radius*2}
\xdef\verticalLength{\pgfmathresult} \xdef\verticalLength{\pgfmathresult}
\xdef\horizontalLength{\pgfmathresult} \xdef\horizontalLength{\pgfmathresult}
\path (\pos) -- ++(-\radius, -\radius) coordinate (start); \path (\pos) -- ++(-\radius, -\radius) coordinate (start);
\pgfmathparse{\verticalLength * \horizontalLength / \pgfpie@sum} \pgfmathparse{\verticalLength * \horizontalLength / \pgfpie@sum}
\let\squareUnit\pgfmathresult \let\squareUnit\pgfmathresult
% drawing loop % drawing loop
\foreach \p/\t [count=\i from 0] in {#2} \foreach \p/\t [count=\i from 0] in {#2}
{ {
\pgfpie@findColor{\i} \pgfpie@findColor{\i}
\ifthenelse{\lengthtest{\verticalLength cm > \horizontalLength cm}} \ifthenelse{\lengthtest{\verticalLength cm > \horizontalLength cm}}
{ {
\pgfmathparse{\p * \squareUnit / \horizontalLength} \pgfmathparse{\p * \squareUnit / \horizontalLength}
\let\height\pgfmathresult \let\height\pgfmathresult
\pgfpie@square{start}{\horizontalLength,\height} \pgfpie@square{start}{\horizontalLength,\height}
{\p} {\p}
{\thecolor} {\thecolor}
{\t} {\t}
%label %label
\iflegend \iflegend
\else \else
\ifthenelse{\equal{\pgfpie@text}{inside}} \ifthenelse{\equal{\pgfpie@text}{inside}}
{} {}
{ {
\path (start) -- ++(\horizontalLength,\height*0.5) node[inner \path (start) -- ++(\horizontalLength,\height*0.5) node[inner
sep=0, \pgfpie@text=0:\t]{}; sep=0, \pgfpie@text=0:\t]{};
} }
\fi \fi
\pgfmathparse{\verticalLength - \height} \pgfmathparse{\verticalLength - \height}
\xdef\verticalLength{\pgfmathresult} \xdef\verticalLength{\pgfmathresult}
\path (start) -- ++(0, \height) coordinate (start); \path (start) -- ++(0, \height) coordinate (start);
} }
{ {
\pgfmathparse{\p * \squareUnit / \verticalLength } \pgfmathparse{\p * \squareUnit / \verticalLength }
\let\width\pgfmathresult \let\width\pgfmathresult
\pgfpie@square{start}{\width,\verticalLength} \pgfpie@square{start}{\width,\verticalLength}
{\p} {\p}
{\thecolor} {\thecolor}
{\t} {\t}
%label %label
\iflegend \iflegend
\else \else
\ifthenelse{\equal{\pgfpie@text}{inside}} \ifthenelse{\equal{\pgfpie@text}{inside}}
{} {}
{ {
\path (start) -- ++(\width*0.5,\verticalLength) node[inner \path (start) -- ++(\width*0.5,\verticalLength) node[inner
sep=0, \pgfpie@text=90:\t]{}; sep=0, \pgfpie@text=90:\t]{};
} }
\fi \fi
\pgfmathparse{\horizontalLength - \width} \pgfmathparse{\horizontalLength - \width}
\xdef\horizontalLength{\pgfmathresult} \xdef\horizontalLength{\pgfmathresult}
\path (start) -- ++(\width, 0) coordinate (start); \path (start) -- ++(\width, 0) coordinate (start);
} }
} }
%%%%%%%%%% SQUARE PIE END %%%%%%%%%%% %%%%%%%%%% SQUARE PIE END %%%%%%%%%%%
\else \else
\ifcloud \ifcloud
%%%%%%%%%% CLOUD PIE BGEIN %%%%%%%%%%% %%%%%%%%%% CLOUD PIE BGEIN %%%%%%%%%%%
% drawing loop % drawing loop
\foreach \p/\t [count=\i from 0] in {#2} \foreach \p/\t [count=\i from 0] in {#2}
{ {
% find explode % find explode
\pgfpie@findExplode{\i} \pgfpie@findExplode{\i}
\def\cloudGap{\theexplode + 0.1} \def\cloudGap{\theexplode + 0.1}
\pgfmathparse{sqrt(\p / \pgfpie@sum) * \radius} \pgfmathparse{sqrt(\p / \pgfpie@sum) * \radius}
\let\cloudR\pgfmathresult \let\cloudR\pgfmathresult
\ifnum \i = 0 \ifnum \i = 0
% first cloud % first cloud
\coordinate (O) at (\pos); \coordinate (O) at (\pos);
\xdef\cloudRone{\cloudR} \xdef\cloudRone{\cloudR}
\xdef\cloudExtendDir{180+\rotate} \xdef\cloudExtendDir{180+\rotate}
\else \else
\ifnum \i = 1 \ifnum \i = 1
% second cloud % second cloud
\xdef\cloudRtwo{\cloudR} \xdef\cloudRtwo{\cloudR}
\xdef\cloudExtendDir{45+\rotate} \xdef\cloudExtendDir{45+\rotate}
\path (O) -- ++(\cloudExtendDir:\cloudRone+\cloudGap+\cloudRtwo) coordinate (O); \path (O) -- ++(\cloudExtendDir:\cloudRone+\cloudGap+\cloudRtwo) coordinate (O);
\else \else
% next cloud % next cloud
\pgfmathparse{\cloudRone+\cloudGap+\cloudRtwo} \pgfmathparse{\cloudRone+\cloudGap+\cloudRtwo}
\let\la\pgfmathresult \let\la\pgfmathresult
\pgfmathparse{\cloudRone+\cloudGap+\cloudR} \pgfmathparse{\cloudRone+\cloudGap+\cloudR}
\let\lb\pgfmathresult \let\lb\pgfmathresult
\pgfmathparse{\cloudRtwo+\cloudGap+\cloudR} \pgfmathparse{\cloudRtwo+\cloudGap+\cloudR}
\let\lc\pgfmathresult \let\lc\pgfmathresult
\pgfmathparse{\la^2+\lc^2-\lb^2} \pgfmathparse{\la^2+\lc^2-\lb^2}
\let\tmp\pgfmathresult \let\tmp\pgfmathresult
\pgfmathparse{180 - acos(\tmp / 2 / \la / \lc)} \pgfmathparse{180 - acos(\tmp / 2 / \la / \lc)}
\let\cloudRot\pgfmathresult \let\cloudRot\pgfmathresult
\ifodd \i \ifodd \i
\pgfmathparse{-\cloudRot} \pgfmathparse{-\cloudRot}
\let\cloudRot\pgfmathresult \let\cloudRot\pgfmathresult
\fi \fi
\pgfmathparse{\cloudExtendDir - \cloudRot} \pgfmathparse{\cloudExtendDir - \cloudRot}
\xdef\cloudExtendDir{\pgfmathresult} \xdef\cloudExtendDir{\pgfmathresult}
\path (O) -- ++(\cloudExtendDir:\lc) coordinate (O); \path (O) -- ++(\cloudExtendDir:\lc) coordinate (O);
\xdef\cloudRone{\cloudRtwo} \xdef\cloudRone{\cloudRtwo}
\xdef\cloudRtwo{\cloudR} \xdef\cloudRtwo{\cloudR}
\fi \fi
\fi \fi
% find color % find color
\pgfpie@findColor{\i} \pgfpie@findColor{\i}
\pgfpie@cloud{O}{\cloudR}{\p} \pgfpie@cloud{O}{\cloudR}{\p}
{\thecolor}{\style}{\t} {\thecolor}{\style}{\t}
% label % label
\iflegend \iflegend
\else \else
\ifthenelse{\equal{\pgfpie@text}{inside}} \ifthenelse{\equal{\pgfpie@text}{inside}}
{} {}
{ {
\path (O) -- ++(\cloudExtendDir:\cloudR) \path (O) -- ++(\cloudExtendDir:\cloudR)
node[inner sep=0, \pgfpie@text=\cloudExtendDir:\t] {}; node[inner sep=0, \pgfpie@text=\cloudExtendDir:\t] {};
} }
\fi \fi
} }
%%%%%%%%%% CLOUD PIE BGEIN %%%%%%%%%%% %%%%%%%%%% CLOUD PIE BGEIN %%%%%%%%%%%
\else \else
%%%%%%%%%% CIRCLE PIE BGEIN %%%%%%%%%%% %%%%%%%%%% CIRCLE PIE BGEIN %%%%%%%%%%%
\ifpolar \ifpolar
\xdef\maxValue{0} \xdef\maxValue{0}
\foreach \p/\e in {#2} { \foreach \p/\e in {#2} {
\ifnum \maxValue < \p \ifnum \maxValue < \p
\xdef\maxValue{\p} \xdef\maxValue{\p}
\fi \fi
} }
\pgfmathparse{\pgfpie@sum / \value{pgfpie@sliceLength}} \pgfmathparse{\pgfpie@sum / \value{pgfpie@sliceLength}}
\xdef\polarangle{\pgfmathresult} \xdef\polarangle{\pgfmathresult}
\pgfmathparse{\radius / sqrt(\maxValue)} \pgfmathparse{\radius / sqrt(\maxValue)}
\xdef\polarRadiusUnit{\pgfmathresult} \xdef\polarRadiusUnit{\pgfmathresult}
\else \else
\xdef\theradius{\radius} \xdef\theradius{\radius}
\fi \fi
\xdef\pgfpie@angleBegin{\the\pgfpie@angleEnd} \xdef\pgfpie@angleBegin{\the\pgfpie@angleEnd}
% drawing loop % drawing loop
\foreach \p/\t [count=\i from 0] in {#2} \foreach \p/\t [count=\i from 0] in {#2}
{ {
\pgfmathsetlength{\pgfpie@angleEnd}{\pgfpie@angleBegin} \pgfmathsetlength{\pgfpie@angleEnd}{\pgfpie@angleBegin}
\ifpolar \ifpolar
% Polar area diagram % Polar area diagram
\pgfmathaddtolength{\pgfpie@angleEnd}{\polarangle} \pgfmathaddtolength{\pgfpie@angleEnd}{\polarangle}
\pgfmathparse{sqrt(\p) * \polarRadiusUnit} \pgfmathparse{sqrt(\p) * \polarRadiusUnit}
\xdef\theradius{\pgfmathresult} \xdef\theradius{\pgfmathresult}
\else \else
% normal pie % normal pie
\pgfmathaddtolength{\pgfpie@angleEnd}{\p} \pgfmathaddtolength{\pgfpie@angleEnd}{\p}
\fi \fi
% find explode % find explode
\pgfpie@findExplode{\i} \pgfpie@findExplode{\i}
% find color % find color
\pgfpie@findColor{\i} \pgfpie@findColor{\i}
\pgfpie@slice{\pgfpie@angleBegin/\pgfpie@sum*360+\rotate} \pgfpie@slice{\pgfpie@angleBegin/\pgfpie@sum*360+\rotate}
{\the\pgfpie@angleEnd/\pgfpie@sum*360+\rotate} {\the\pgfpie@angleEnd/\pgfpie@sum*360+\rotate}
{\p} {\p}
{\t} {\t}
{\theexplode} {\theexplode}
{\thecolor} {\thecolor}
{\theradius} {\theradius}
{\pos} {\pos}
\xdef\pgfpie@angleBegin{\the\pgfpie@angleEnd} \xdef\pgfpie@angleBegin{\the\pgfpie@angleEnd}
} }
%%%%%%%%%% CIRCLE PIE END %%%%%%%%%%% %%%%%%%%%% CIRCLE PIE END %%%%%%%%%%%
\fi \fi
\fi \fi
% legend % legend
\iflegend \iflegend
\coordinate[xshift=0.8cm, \coordinate[xshift=0.8cm,
yshift=(\value{pgfpie@sliceLength}*0.5+1)*0.5cm] (legendpos) at yshift=(\value{pgfpie@sliceLength}*0.5+1)*0.5cm] (legendpos) at
(current bounding box.east); (current bounding box.east);
\begin{scope}[node distance=0.5cm] \begin{scope}[node distance=0.5cm]
\foreach \p/\t [count=\i from 0] in {#2} \foreach \p/\t [count=\i from 0] in {#2}
{ {
\pgfpie@findColor{\i} \pgfpie@findColor{\i}
\node[draw, fill=\thecolor, \style, below of=legendpos, label=0:\t] (legendpos) {}; \node[draw, fill=\thecolor, \style, below of=legendpos, label=0:\t] (legendpos) {};
} }
\end{scope} \end{scope}
\fi \fi
} }
%%% End of pgf-pie.sty %%% End of pgf-pie.sty
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%