# [pstricks] plotstyle=line

Herbert Voss Herbert.Voss at FU-Berlin.DE
Tue Aug 7 18:31:51 CEST 2012

Am 01.08.2012 16:19, schrieb Alexander Michel:

> 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=line,linecolor=blue,linewidth=1pt,linejoin=2]{\data}

gives a better result

Herbert

> \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
>
> /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?
>
>
> Alex
>
>
>
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
> archive: http://www.tug.org/pipermail/pstricks/
>