[pstricks] Error bars and pstScalePoints

Martin Buchmann Martin.Buchmann at uni-jena.de
Mon Jul 10 14:39:37 CEST 2006


Hi,

I want to draw some data with error bars. Of course I have checked the
examples and found DotErrorBar which comes very close. But now I need to
use the pstScalePoints macro from pstricks-add.sty to scale my data
before I plot it. As far as I see now this macro does not work with the
way the error bars are drawn, at least the following example does not
lead to a graph containing data.

Is there a way to get it work?

Best regards
   Martin

\begin{filecontents}{minimal.dat}
0.3 116 -14 14
1.3 128 -16 16
2.4 133 -14 14
3.5 138 -15 15
4.6 141 -14 14
5.7 146 -16 16
6.9 143 -10 10
8.0 177 -22 22
9.0 218 -24 24
\end{filecontents}

\documentclass[11pt,a4paper]{article}

\usepackage{pst-plot,pst-node,pstricks-add}
\def\pshlabel#1{\sffamily #1}
\def\psvlabel#1{\sffamily #1}

\pagestyle{empty}

\makeatletter
\SpecialCoor
\def\errorLine{\@ifnextchar[{\pst at errorLine}{\pst at errorLine[]}}
\def\pst at errorLine[#1](#2)#3#4{{%
     \ifx#1\empty\else\psset{#1}\fi
     \pst at getcoor{#2}\pst at tempb
     \def\@errorMin{#3}
     \def\@errorMax{#4}
     \psline{|-|}%
     (!%
         /yDot \pst at tempb exch pop \pst at number\psyunit div def
         /xDot \pst at tempb pop \pst at number\psxunit div def
         xDot yDot \@errorMin\space add%
     )(!%
         /yDot \pst at tempb exch pop \pst at number\psyunit div def
         /xDot \pst at tempb pop \pst at number\psxunit div def
         xDot yDot \@errorMax\space add%
     )
}}
%
\def\GetCoordinates#1{\expandafter\GetCoordinates at i#1}
\def\GetCoordinates at i #1{\GetCoordinates at ii#1}
\def\GetCoordinates at ii#1 #2 #3 #4 #5 #6 #7 #8 {%
     \DoCoordinate{#2}{#4}%
     \errorLine[linecolor=red, linewidth=2pt](#2,#4){#6}{#8}% <<<<<
     \@ifnextchar D{\GetCoordinates at ii}{}%
}
\makeatother

\begin{document}

\begin{pspicture}(-1.75,-1.5)(11.0,9)
   % Die Achsen
   \psaxes[axesstyle=frame,ticksize=5pt,Oy=100,Dy=20,dy=0.7998](10,8)

   % Die Daten
   % 5 min
   \readdata{\Data}{minimal.dat}
   \pstScalePoints(1,0.04){}{ 100 sub }
   % Die Punkte samt Fehler
   \def\DoCoordinate#1#2{\psdot(#1,#2)}%
   \GetCoordinates{\Data}

\end{pspicture}

\show\Verror

\end{document}

-- 
WELL-ADJUSTED:
	The ability to play bridge or golf as if they were games.




More information about the PSTricks mailing list