I have the following piecharts in two subfigures, however:
- One of them is blocking the legend as shown in the picture. Is there any workaround? I tried modifying
pgf-pie(thanks Xu Yuan!)but to no avail. - Also, the two subfigures are not aligned horizontally even though I've added an extra command of
{b!} Is it possible to have the smallest percentage visible by having a line drawn out (
text=pin) alike since there's no space to label in the pie chart?\documentclass{scrbook} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{subcaption} \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \usepackage{pgf-pie} \begin{document} \begin{figure*}[t!] \centering \begin{subfigure}[b!]{0.5\textwidth} \begin{tikzpicture} \tikzset{lines/.style={draw=white},} \pie[color={Orchid, GreenYellow, BurntOrange},sum=auto, after number=\%,every only number node/.style={text=black},text=legend,style={lines}]{60.8/Natural Gas,36.4/Petroleum,2.8/Others} \end{tikzpicture} \caption{2003} \end{subfigure}% ~ \begin{subfigure}[b!]{0.5\textwidth} \begin{tikzpicture} \tikzset{lines/.style={draw=white},} \pie[color={Orchid, GreenYellow, BurntOrange},sum=auto, after number=\%,every only number node/.style={text=black},style={lines}]{95.15/,0.67/,4.18/} \end{tikzpicture} \caption{2017} \end{subfigure} \caption{Singapore's fuel mix for electricity generation} \end{figure*} \end{document}


\draw (current bounding box.south west) rectangle (current bounding box.north east);before the first\end{tikzpicture}, you will see that the picture is wider than the space you give it with\begin{subfigure}[b!]{0.5\textwidth}. So either give the picture more space or make it smaller. – Dec 02 '18 at 23:22pgf-pie, and came up with a very rusty method to add pins:https://tex.stackexchange.com/a/451154/121799. I am definitely not claiming it is elegant, but that was the best I could come up with at that time. This does not mean much, but may suggest that having these pins may require more than adding a key somewhere. And you could draw these two pies in one picture, and shift them against each other, and then add the captions in nodes to have the desired vertical and horizontal alignment. – Dec 02 '18 at 23:29