[pstricks] listplot
Herbert Voss
Herbert.Voss at FU-Berlin.DE
Mon Jul 3 17:21:26 CEST 2017
Poul Riis schrieb:
> Just one small comment: The option barwidth=0.4 seems not to be relevant
> here?
>
> And reminding on my more general question: How can I store the points from
> the data file in an array so that I can later refer to the (postscript)
> coordinates of point nr. i?
The coordinates are saved in the PS array Points and can be
used later if you put the array Points into the global dict
and the number of points is n.
The points are saved in the wrong order!
\getCoor{8} will get the pair of x,y, counted from 1
It can easily be extended to \getxCoor . In the below example I marked
three points by a cross
Herbert
\documentclass{article}
\usepackage[dvips,x11names]{pstricks}
\usepackage{pst-plot}
\makeatletter
\def\psbar at ii{\addto at pscode{startGlobal false \tx at NArray endGlobal
\psbar at iii}}
\def\psbar at iii{%
newpath
n 1 sub {
/Yval exch def /Xval exch def
2 copy /YNext exch def Xval sub /DX exch def
Xval 0 moveto % Start Point
0 YNext rlineto % relative move
DX 0 rlineto
0 YNext neg rlineto
DX neg 0 rlineto
} repeat
}%
\let\UserCoor\tx at UserCoor
\makeatother
\def\getCoor#1{Points n #1 sub 2 mul get Points n #1 sub 2 mul 1 add get
\UserCoor}
\thispagestyle{empty}
\begin{document}
\readdata{\data}{../Downloads/simon.dat}
\psset{xAxisLabel=Time (minutes),
yAxisLabel=Load (W),xAxisLabelPos={c,-10},yAxisLabelPos={-5,c}}%
\begin{psgraph}[axesstyle=frame,xticksize=0 110,yticksize=0
100,Dx=10,Dy=10,xsubticks=5,subticksize=1](0,0)(100,110){15cm}{11cm}
\listplot[linecolor=Red1,fillcolor=Cornsilk1,fillstyle=solid,
linewidth=0.1pt,plotstyle=bar,barwidth=0.4]{\data}
\listplot[linecolor=Blue1, linewidth=2pt]{\data}
\psline[arrows=->](0,0)(100,0)
\psline[arrows=->](0,0)(0,110)
%
\multido{\iA=0+2}{35}{\psdot(!Points \iA\space 2 getinterval aload pop
\UserCoor)}
\psdot[linecolor=red,dotstyle=x,dotscale=3](! \getCoor{3} )
\psdot[linecolor=red,dotstyle=x,dotscale=3](! \getCoor{13} )
\psdot[linecolor=red,dotstyle=x,dotscale=3](! \getCoor{30} )
\end{psgraph}
\end{document}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 6.png
Type: image/png
Size: 158310 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20170703/74526236/attachment-0001.png>
More information about the PSTricks
mailing list