I am using the package pgf-pie and want to have two pie charts next to each other but using the same legend. How can I have the legend centered below the two charts?
Mini example:
\documentclass[tikz,border=10pt]{standalone}
\usepackage{pgf-pie}
\begin{document}
\begin{center}
\begin{minipage}{.45\textwidth}
\begin{tikzpicture}
\tikzset{lines/.style={draw=white},}
\pie[color={viola, rosso, giallo, blu, verde},sum=auto, after number=,text=legend,every only number node/.style={text=black},style={lines}]{10/A,20/B,30/C,10/D}
\end{tikzpicture}
\end{minipage}
\begin{minipage}{.45\textwidth}
\begin{tikzpicture}
\tikzset{lines/.style={draw=white},}
\pie[color={viola, rosso, giallo, blu, verde},sum=auto, after number=,text=legend,every only number node/.style={text=black},style={lines}]{10/A,20/B,30/C,10/D}
\end{tikzpicture}
\end{minipage}
\end{center}
\end{document}
This example plots two pie charts side by side but each with a single legend.
Best Answer
According
pgf-pie
documentation you can usepos
option to place apie
inside atikzpicture
. You don't needminipage
.And also from examples, seems that a second parameter inside values list (
10/A, 20/B
) adds names to pie. If you don't want a second legend, write a values list with empty names. If the order is correct, the first legend will serve.