2

I am dealing with package pgf-pie to draw some pictures.

However, I would like to hide some percentages, that the smaller, because they don't fit in the sectors. I would just like to leave the ones with larger percentages.

See my figure.

enter image description here

The code is the following:

\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots,tikz}
\usepackage{pgf-pie}

\begin{document}

\begin{tikzpicture}[scale=0.5] \pie[radius=4] {45/Palm., 25/SP, 29/Cor., 1/San.} \end{tikzpicture}

\end{document}

There is a possibility of hide all numbers, but I don't want, only the smallers. Can anyone help me please?

Stefan Pinnow
  • 29,535

2 Answers2

5

This question is very similar to this one, one can more or less copy the answer.

\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{pgf-pie}

\begin{document}

\begin{tikzpicture}[scale=0.5] \def\printonlylargeenough#1#2{\unless\ifdim#2pt<#1pt\relax #2\printnumbertrue \else \printnumberfalse \fi} \newif\ifprintnumber \pie[radius=4,before number=\printonlylargeenough{10}, after number=\ifprintnumber%\fi] {45/Palm., 25/SP, 29/Cor., 1/San.} \end{tikzpicture} \end{document}

enter image description here

3

This will only display percentages larger than 10%.

\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots,tikz}
\usepackage{pgf-pie}

\makeatletter \providecommand\pgfpie@ifnum[3]{% \ifnum\numexpr#1\relax#2\numexpr#3\relax \expandafter\pgfutil@firstoftwo \else \expandafter\pgfutil@secondoftwo \fi }

\renewcommand\pgfpie@numbertext[1]{% \pgfpie@ifnum{#1}{>}{10}{% #1%% }{}% } \makeatother

\begin{document}

\begin{tikzpicture}[scale=0.5] \pie[radius=4] {45/Palm., 25/SP, 29/Cor., 1/San.} \end{tikzpicture}

\end{document}

Henri Menke
  • 109,596