[pstricks] Working with multiple data columns

Brandon Kuczenski brandon at 301south.net
Sun Jan 24 04:08:13 CET 2010


On Sat, 23 Jan 2010, Herbert Voss wrote:

> Am 23.01.2010 21:00, schrieb Brandon Kuczenski:
>
> http://tug.org/PSTricks/main.cgi?file=pst-plot/DataExamples#polarplot
>
> the last example shows how two values can be added
> for a third plot.
>

\makeatletter
\pst at def{ScalePoints}<%
   /y ED /x ED
   counttomark dup dup cvi eq not { exch pop } if
   /m exch def /n m 2 div cvi def
   n { /RAD exch def  % save y as radius
       dup            % xVal xVal
       cos exch sin RAD mul y mul m 1 roll
       RAD mul x mul m 1 roll
       /m m 2 sub def } repeat>
\makeatother

What does 'ED' mean?

Thank you, this looks promising.. you are basically using ScalePoints to 
'pre-process' the data queue-wise, so that x, y are turned into 
y*cos(x), y*sin(x).  This is basically what I want to do.

I would be pleased to know your comments on the following implementation:

\documentclass{minimal}

\usepackage{pstricks-add}

\def\data{% x y1 y2 y3
  1  45   67   89
  2  46   66   87
  3  47   62   88
  4  44   61   80
  5  42   52   72
}
\begin{document}
\begin{pspicture}(0,0)(10,10)
\begin{psgraph}[axesstyle=none,labels=none,ticks=none](0,0)(6,100){10cm}{10cm}
     \psaxes[Dy=10](0,0)(6,100)
     % say we want to plot y3 - y1
     \listplot[linecolor=red]{\data
       counttomark 4 div cvi /m exch def % m = num rows
         m { % x y1 y2 y3
           exch pop % ditch y2
           exch sub % y3 - y1
           counttomark cvi  2 roll % shift to front
         } repeat
     }
   \end{psgraph}
\end{pspicture}
\end{document}


Is it possible to somehow "\savelist" to capture the results of such a 
computation, instead of \listplot to plot it?

Best,
-Brandon



More information about the PSTricks mailing list