[pstricks] LineToXAxis and negative numbers and axises.

Dirk-Willem van Gulik dirkx at webweaving.org
Mon Oct 31 12:37:13 CET 2011


I am struggling a bit with LineToXAxis and negative numbers.

LineToXAxis works well for positive numbers - even when the axis is non-zero  (figure 1) or even negative (figure 2 in below); lines are drawn to the bottom.

But when the numbers are mostly negative - LineToXAxis seems to draw to 0 - even though Oy is set.

Example below (and in http://pastebin.com/wjtErgNU, result onhttp://people.apache.org/~dirkx/wjtErgNU.pdf). It is figure 3 where it goes wrong. 

The use case is a Spectrum (where -120 dBm is a typical noise floor; and signals go 'up' to -20 dBm). So one would want all lines in figure 3 to be drawn to -120.

Any suggestions as to what I am doing wrong ?

Thanks,

Dw.


\documentclass[12pt]{amsart}
\usepackage{geometry}
\usepackage{pst-plot}
\usepackage{pst-node}
\usepackage{auto-pst-pdf}

\geometry{a4paper}
\begin{document}

\begin{figure}[htbp]
\begin{center}

\begin{pspicture}(0,0)(5,10)
\savedata{\data}[1 10 2 12 3 15]

\begin{psgraph}[arrows=->,Dx=2,Dy=5,Oy=-5,subticks=4](0,1)(6,20){6cm}{3cm}
 \listplot[linecolor=red,linewidth=2pt,showpoints=true,plotstyle=LineToXAxis]{\data}
\end{psgraph}
\end{pspicture}

\caption{Draw to Axis, Axis at -5 -- bars to just \emph{below} actual axis.}
\end{center}
\end{figure}
\begin{figure}[htbp]
\begin{center}

\begin{pspicture}(0,0)(5,10)
\savedata{\data}[1 10 2 12 3 15 4 -2 5 -10]

\begin{psgraph}[arrows=->,Dx=2,Dy=5,Oy=-5,subticks=4](0,1)(6,20){6cm}{3cm}
 \listplot[linecolor=red,linewidth=2pt,showpoints=true,plotstyle=LineToXAxis]{\data}
\end{psgraph}
\end{pspicture}

\caption{Draw to Axis, Axis at -5 -- with negative numbers - same small \emph{below} issue.}
\end{center}
\end{figure}

\begin{figure}[htbp]
\begin{center}
\begin{pspicture}(0,0)(5,10)
\savedata{\data}[1 -10 2 -12 3 -15 4 2 5 10]

\begin{psgraph}[arrows=->,Dx=2,Dy=5,Oy=-20,subticks=4](0,-20)(6,5){6cm}{3cm}
 \listplot[linecolor=red,linewidth=2pt,showpoints=true,plotstyle=LineToXAxis]{\data}
\end{psgraph}
\end{pspicture}

\caption{Draw to Axis, Axis still at -5 -but all negative numbers - and now suddenly draw-to axis goes up?!}
\end{center}
\end{figure}

\end{document}


More information about the PSTricks mailing list