Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm creating pie chart using code below:

\begin{center}
\begin{pspicture}(-5,-4)(4,4)
\psset{unit=1.2}
\psChart[userColor={black!10,black!40},chartSep=10pt,shadow,shadowsize=3pt]{\above,\below}{}{3}
\bfseries%
\rput(psChartI1){TEXTA \above \%}\rput(psChartI2){TEXTB \below \%}
\end{pspicture}
\end{center}

Currently TEXTA & TEXTB are aligned towards circumference, is there any way to center align this text?

UPDATE: (with MWE);

\documentclass{article}
\usepackage{pstricks-add}
\usepackage{pgfplots, pgfplotstable}
\usepackage{datatool}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{pspicture}(-5,-4)(4,4)
\psset{unit=1.2}
\psChart[userColor={black!10,black!40},chartSep=10pt,shadow,shadowsize=3pt]{30,70}{}{3}
\bfseries%
\rput(psChartI1){TEXTA 30 \%}\rput(psChartI2){TEXTB 70 \%}
\end{pspicture}
\end{center}
\end{document}
share|improve this question
1  
Please provide us with MWE (minimal working example). \rput has an optional argument to specify the anchor. –  Oh my ghost Oct 5 '13 at 17:10
    
MWE updated in the question. –  Pawan Mude Oct 5 '13 at 17:20
1  
Herbert's answer is much more elegant than mine. –  Oh my ghost Oct 5 '13 at 18:25

2 Answers 2

up vote 4 down vote accepted

Set the distance of the inner chart node to 0.5:

\documentclass{article}
\usepackage{pstricks-add}

\begin{document}
\begin{pspicture}(-5,-4)(4,4)
\psset{unit=1.2}
\psChart[userColor={black!10,black!40},chartSep=10pt,chartNodeI=0.5,%%%%%
         shadow,shadowsize=3pt]{30,70}{}{3}
\rput(psChartI1){\bf TEXTA 30\%}
\rput(psChartI2){\bf TEXTB 70\%}
%\psdots(psChartI1)(psChartI2)%% for a test
\end{pspicture}
\end{document}

enter image description here

share|improve this answer
6  
I really don't understand why you still use a command (\bf) that has been declared obsolete twenty years ago. If you want to use it in your own documents, fine; I find it wrong to use it in a public place where we are expected to teach proper usage of LaTeX. –  egreg Oct 5 '13 at 17:44
2  
What has PSTricks to do with \bf? Try changing article into memoir and see the result. –  egreg Oct 5 '13 at 17:48
    
Thank You, it's working perfectly for ratio of 30,70; Is there any way to make it generic (to make center align for any values ex: 10:90 , 5:95, 50,50 and so on)? –  Pawan Mude Oct 5 '13 at 18:01
2  
@PawanMude: see my edit. I set the relative distance of the inner node to 0.5 –  Herbert Oct 5 '13 at 18:09
    
Thank You, it's working for other values. –  Pawan Mude Oct 5 '13 at 18:30
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pstricks-add}

\begin{document}

\multido{\i=0+15}{24}{%
\begin{pspicture}(-4,-4)(4,4)
\psset{unit=1.2}
\psChart[userColor={black!10,black!40},chartSep=10pt,shadow,shadowsize=3pt]{30,70}{}{3}
\bfseries
\rput{\i}(1.5;54){TEXTA 30 \%}
\rput{\i}(1.5;234){TEXTB 70 \%}
\end{pspicture}}

\end{document}

enter image description here

share|improve this answer
3  
Animation proves that the labels are centered. –  Oh my ghost Oct 5 '13 at 17:37
1  
Thank You PGFTricks for sharing answer. It's working as desired. –  Pawan Mude Oct 5 '13 at 18:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.