4

Does anyone know how to draw a small pie-chart without labels?

\documentclass{article}
\usepackage{tikz} 
\usepackage{pgf-pie}

\begin{document}

\begin{tikzpicture}
\pie[ 
 color = {black!10, black!40},radius = 0.5] {37.5, 62.5}    
\end{tikzpicture}

\end{document}

Thanks in advance!

2 Answers 2

1

Set the /tikz/nodes={text opacity=0,overlay} as option for\pie.

enter image description here

Code:

\documentclass{article}
\usepackage{tikz} 
\usepackage{pgf-pie}

\begin{document}

\begin{tikzpicture}
\pie[ 
  color = {black!10, black!40},radius = .5,
  /tikz/nodes={text opacity=0,overlay}% <- 
] {37.5, 62.5}
\end{tikzpicture}
\end{document}
1
  • Thats a pretty simple way! Thx!
    – user100999
    Apr 15, 2016 at 20:28
3

You can find an example using Tikz here. You can remove the labels by removing the corresponding lines. You obtain the following code.

\documentclass{article}

\usepackage{calc}
\usepackage{ifthen}
\usepackage{tikz}
\begin{document}
\newcommand{\slice}[4]{
  \pgfmathparse{0.5*#1+0.5*#2}
  \let\midangle\pgfmathresult
  \draw[thick,fill=black!10] (0,0) -- (#1:1) arc (#1:#2:1) -- cycle;
}

\begin{tikzpicture}[scale=3]

\newcounter{a}
\newcounter{b}
\foreach \p/\t in {20/type A, 4/type B, 11/type C, 49/type D, 16/other}
{
  \setcounter{a}{\value{b}}
  \addtocounter{b}{\p}
  \slice{\thea/100*360}
      {\theb/100*360}
      {\p\%}{\t}
}

\end{tikzpicture}

\end{document}

You must log in to answer this question.