1

I was wondering whether it is possible to code a wheelchart around exploded slices of an initial pie chart. My code so far produces a pie chart with the relevant slices exploded and an awkward little separate pie chart floating around it. Ideally, interpersonal violence and collective violence would wheel around the categories ''Government & Social'' and ''Emergency''.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz, pgfplots}
\usepackage{pgf-pie} 

\begin{document}

\hspace{6cm}\begin{minipage}[l]{0.6\linewidth}
\begin{tikzpicture}[scale=0.4]
\tikzstyle{every node}=[font=\small] 

\pie[pos ={1, 2}, 
explode={1, 1, 0, 0, 0, 0, 0},
text=pin, hide number,
    color = {
    blue!40!,
            red!40,
        violet!40!}
]{
9.3/Collective Violence (95.6\%),
2.9/Interpersonal Violence (4.4\%)
}
\end{tikzpicture}
    \end{minipage}%
  \hfill%
     \hspace*{0cm}

     \begin{minipage}[r]{0.09\linewidth}
\begin{tikzpicture}[scale=0.8]
 \noindent
\tikzstyle{every node}=[font=\small]
\pie[pos ={1, 2}, 
explode={0.5, 0.5, 0, 0, 0, 0, 0, 0, 0},
text=pin, hide number,
    color = {
        blue!40!,
        blue!60!,
        red!60, red!70,
        blue!70,
        red!40}
]{
12.2/Government \& Social (12.18\%),
5.4/Emergency (5.40\%),
20.1/Budget \& Debt (20.07\%),
17.3/Infrastructure (17.26\%),
11.0/Business \& Industry (11.04\%),
8.8/Necessities (8.84\%),
6.9/Health (6.89\%),
18.3/Multisector \& Others (13.08\%)
}
\label{fig:}
    \end{tikzpicture}
    \end{minipage}
    \newline
    \raggedright
\footnotesize{\textit{Text}}

\end{document}

I sketched my vision below, in the hope it may help you visualise what I mean exactly.

Any help would be highly appreciated! Thanks, Leslie

The vision

2
  • 2
    The wheelchart package may be helpful. The documentation has examples of this sort. Also, please post a minimal working example of compilable code (including \documentclass)
    – mbert
    Nov 8, 2022 at 16:55
  • Dear @mbert. Thank you very much for your answer, you are completely right, I forgot to add the packages. I edited the working example into a compilable entity. I have already inspected the wheelchair package (page 7 looks particularly promising for my purposes), however I was not able to make it work (not even the working example, I am afraid). Do you think the pie-chart package could perform the same functions as the wheelchart package or would you switch packages all together?
    – Leslie
    Nov 9, 2022 at 12:23

1 Answer 1

1

A pie diagram is a bad lying way to represent data. Worse is a exploder pie diagram. -and unforgivable is a diagram with extra slices, where area loses all meaning.

\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgf-pie}
\begin{document}
\begin{tikzpicture}
\pie[
pos={0.05,-0.1},
explode={1, 1},
hide number,
color={blue!40!, red!40},
text opacity=0,
]{
9.3/Collective Violence (95.6\%),
2.9/Interpersonal Violence (4.4\%)
}
\pie[
explode={0.5, 0.5, 0, 0, 0, 0, 0, 0, 0},
text=pin, hide number,
color={blue!40!, blue!60!, red!60, red!70, blue!70, red!40},
font=\small,
]{
12.2/Government \& Social (12.18\%),
5.4/Emergency (5.40\%),
20.1/Budget \& Debt (20.07\%),
17.3/Infrastructure (17.26\%),
11.0/Business \& Industry (11.04\%),
8.8/Necessities (8.84\%),
6.9/Health (6.89\%),
18.3/Multisector \& Others (13.08\%)
}
\node[font=\small, pin=-20:{Collective Violence (95.6\%)}] at (3.8,1) {};
\node[font=\small, pin=20:{Interpersonal Violence (4.4\%)
}] at (3.1,2.4) {};
\end{tikzpicture}
\end{document}

Exploded pie diagram with extra pies in the background

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .