[pstricks] How to draw error bars in a diagram
Herbert Voss
Herbert.Voss at alumni.TU-Berlin.DE
Mon Apr 28 15:04:43 CEST 2003
Martin Buchmann schrieb:
> I never saw something like this before with pstricks but it should be
> possible after all the sophisticated 3D stuff presented here recently.
> Has anyone a idea how i could achieve this?
I do not know, if I understand well.
Herbert
\documentclass[a4paper]{article}
\usepackage{pst-plot}
\makeatletter
\let\beginplot at ErrorLine\beginplot at line
\def\endplot at ErrorLine{\psErrorLine at ii}
\let\beginqp at ErrorLine\beginqp at line
\let\doqp at ErrorLine\doqp at line
\let\endqp at ErrorLine\endqp at line
\let\testqp at ErrorLine\testqp at line
%
\def\psErrorLine at ii{%
\addto at pscode{\pst at cp \psline at iii \tx at ErrorLine}%
\end at OpenObj%
}
%
\def\tx at ErrorLine{ErrorLine }
\def\@errorVal{0.3}% +- 30% error range (only demo)
%
% Adapted from Line
\pst at def{ErrorLine}<{%
/min 1 \@errorVal\space sub def
/max 1 \@errorVal\space add def
NArray
n 0 eq not
{ ArrowA
/n n 2 sub def
CP 2 copy min mul moveto max mul Lineto
n { 2 copy min mul moveto max mul Lineto } repeat
CP
4 2 roll
ArrowB
2 copy moveto pop 0
L
pop pop } if}>
\makeatother
\pagestyle{empty}
\begin{document}
\psset{xunit=0.0333cm,yunit=2.5cm}
\begin{pspicture}(0,-1)(400,1)
\psline{->}(0,0)(400,0)
\psline{->}(0,-1)(0,1)
\psplot[%
plotstyle=ErrorLine,%
plotpoints=50,%
showpoints=true,%
dotstyle=o,%
dotsize=0.1]{0}{360}{x sin}
\end{pspicture}
\end{document}
More information about the PSTricks
mailing list