1

I would like to know how to prevent the labels of a pie chart from overlapping and to have more control over their position?

I am using the pgf-pie package, I don't know if it is possible to easily modify the package to make this possible. If not, I'm also interested in a more "manual" solution without pgf-pie and using tikz.

enter image description here

\documentclass{article}    
\usepackage{pgf-pie}    
\begin{document}
\begin{tikzpicture}
    \pie[rotate=90, text=pin, hide number, sum=auto]{
            1000/{\pgfmathprintnumber{1000.0}},
            300/{\pgfmathprintnumber{300}},
            250/{\pgfmathprintnumber{250}},
            100/{\pgfmathprintnumber{100}},
            31.1/{\pgfmathprintnumber{31.1}},
            25.5/{\pgfmathprintnumber{25.5}},
            21.2/{\pgfmathprintnumber{21.2}}
        };
\end{tikzpicture}
\end{document}
B Legrand
  • 521
  • 1
    You could rotate the labels in the direction of the direction of the bissectrix, for instance – Bernard Mar 08 '22 at 12:43
  • Possible duplicate of https://tex.stackexchange.com/questions/338528/how-to-put-small-numbers-outside-the-pie-slices-without-making-a-mess – John Kormylo Mar 08 '22 at 17:43
  • 1
    @BLegrand I think this package is not so much flexible, that there is an elementary solution for changing the pin-lengths individually. Fear you need to draw the chart by you own. – cis Mar 09 '22 at 13:17

1 Answers1

2

The answer below uses the wheelchart package, which I wrote.

The anchor of the data is determined by the key anchor xsep.

The length of the lines is determined by the key lines. For the fourth and sixth slice, this length is defined separately with the key lines{4,6}.

In the key slices style we use \WClistcolors which refers to items in the list given to the key WClistcolors.

enter image description here

\documentclass[border=6pt]{standalone}
\usepackage{wheelchart}
\begin{document}
\begin{tikzpicture}
\wheelchart[
  anchor xsep=30,
  counterclockwise,
  data=\pgfmathprintnumber{\WCvarA},
  lines=0.5,
  lines{4,6}=1.3,
  pie,
  slices style={
    \WClistcolors,
    draw=black,
    line join=bevel
  },
  WClistcolors={blue!60,cyan!60,yellow!60,orange!60,red!60,blue!60!cyan!60,cyan!60!yellow!60,red!60!cyan!60,red!60!blue!60,orange!60!cyan!60}
]{1000,300,250,100,31.1,25.5,21.2}
\end{tikzpicture}
\end{document}
matexmatics
  • 4,819