[pstricks] plotstyle=line
Alexander Michel
alex at monsterblock.de
Wed Aug 1 16:19:21 CEST 2012
Hi all,
I encountered a problem with plotting numeric values from a
measurement with the pst-plot package. Here the mini example. The file
mess1data.tex with the measured values and the resulting pdf is
attached.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{scrartcl}
%
\usepackage{pst-plot}
%
\begin{document}
%
\input{mess1data}
%
\begin{psgraph}[Dx=100,Dy=5](0,5)(400,35){1\textwidth}{0.2\textwidth}
\listplot[plotstyle=line,linecolor=blue, linewidth=1pt]{\data}
\listplot[plotstyle=TestLine,linecolor=red, linewidth=1pt]{\data}
\end{psgraph}
%
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
As you can see the plotstyle "line" which uses the postscript "lineto"
function generates some weird noise. This "noise" is caused because
postscript interprets the plot as a path and tries to connect the
lines with a "corner". Because the high noise and the nearly parallel
lines, the "corners" get quite big, which looks like noise (see the
blue plot).
Because I have not found an other plotstyle which just draws lines
between the points without creating a path I added my own to
pstricks-add.pro called /TestLine:
/TestLine {
NArray % all x-y pairs on stack
n {moveto % go to current point
2 copy
Lineto
} repeat
} def
By using "moveto" before "Lineto" no path is generated. I was also
able to get it somehow in the pstricks framework so I could use it for
the red plot. Here you see that the weird noise is gone. However,
because of my very limited latex skills I was not really able to get
it into the pstricks framework (see the line from end to start). So my
question is:
Is there another, simpler way I'm not aware of? Or is it possible to
add a similar plotstyle like TestLine to the pstricks package?
Thanks for your help
Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: document.pdf
Type: application/pdf
Size: 56970 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20120801/ef0e083a/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mess1data.tex
Type: application/x-tex
Size: 61211 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20120801/ef0e083a/attachment-0001.tex>
More information about the PSTricks
mailing list