5

I'm able to draw pie chart using tex code mentioned below:

\begin{center}
  \begin{pspicture}(-7,-4)(7,4)
    \psset{unit=1.2}
    \psChart[userColor={black!10,black!40,black!70},shadow,shadowsize=3pt, chartNodeO=1.15]{98,1,1}{}{3}
    \bfseries%
    \ncline[arrows=<-, arrowscale=1.5, nodesepB=2pt]{psChartI1}{psChartO1}
    \ncline[arrows=<-, arrowscale=1.5, nodesepB=2pt]{psChartI2}{psChartO2}
    \ncline[arrows=<-, arrowscale=1.5, nodesepB=2pt]{psChartI3}{psChartO3}
    \rput[c](psChartO1){98 \% scored more than you.}
    \rput[c](psChartO2){1 \% scored less than you.}
    \rput[c](psChartO3){1 \% scored equal to you.}
  \end{pspicture}
\end{center}

MWE code is mentioned here

Issue is when two consecutive pie next to each other are very small (also sometimes text and arrow gets overlapped), text get's overlapped, sample image is mentioned below: enter image description here

Can you please suggest, how to correct this?

1 Answer 1

6
+150

One possibility is to use another reference point than [c] for \rput:

\documentclass[margin=5pt, pstricks]{standalone}
\usepackage{pstricks-add}
\begin{document}
\begin{pspicture}(-9,-4)(9,4)
  \psChart[userColor={black!10,black!40,black!70},shadow,shadowsize=3pt, chartNodeO=1.15]{98,1,1}{}{3}
  \bfseries%
  \ncline[arrows=<-, arrowscale=1.5, nodesepB=2pt]{psChartI1}{psChartO1}
  \ncline[arrows=<-, arrowscale=1.5, nodesepB=2pt]{psChartI2}{psChartO2}
  \ncline[arrows=<-, arrowscale=1.5, nodesepB=2pt]{psChartI3}{psChartO3}
  \rput[r](psChartO1){98 \% scored more than you.}
  \rput[lt](psChartO2){1 \% scored less than you.}
  \rput[lb](psChartO3){1 \% scored equal to you.}
\end{pspicture}
\end{document}

enter image description here

2
  • Is there any way to ensure text always outside the pie? For some of the scenerio, i'm getting text overlapped with the pie
    – Pawan Mude
    Dec 5, 2013 at 16:38
  • 1
    In principle that could be done, but I don't think, that there exists a good automation to layout arbitrary labels taking into account their positions, alignment, length, overlap etc. You can make further manual adjustments of the node positions with e.g. \rput([Xnodesep=0.1,offset=0.2]psChartO1).
    – Christoph
    Dec 6, 2013 at 12:11

You must log in to answer this question.

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