[pstricks] psplot, own plotstyle?

Herbert Voss LaTeX at zedat.fu-berlin.de
Fri May 18 08:28:19 CEST 2007


Ludwig Meyerhoff wrote:
> >From the example code I can see an own plotstyle was defined, but I do
> not understand the Postscript code (honestly, I already have some
> problems understanding the introducing TeX-defines).
>   
here is a simplified version to understand the PS-code

Herbert

\documentclass[a4paper]{article}
\usepackage{pst-plot}
\makeatletter
\let\beginplot at LineToYAxis\beginplot at line  % all from pst-plot
\def\endplot at LineToYAxis{\psLineToYAxis at ii}
\let\beginqp at LineToYAxis\beginqp at line
\let\doqp at LineToYAxis\doqp at line
\let\endqp at LineToYAxis\endqp at line
\let\testqp at LineToYAxis\testqp at line
%
\def\psLineToYAxis at ii{%
\addto at pscode{\pst at cp \psline at iii \tx at LineToYAxis}%
\end at OpenObj}
%
\def\tx at LineToYAxis{LineToYAxis }
%
\pst at def{LineToYAxis}<{
  NArray            % all x-y pairs on stack
  n { 2 copy moveto % go to current point
    0 exch Lineto   % line to y-axis
    pop             % delete old x-value
  } repeat
}>
\makeatother
\pagestyle{empty}
\begin{document}
\psset{xunit=0.0333cm,yunit=2.5cm}
\begin{pspicture}(0,-1.2)(400,1.2)
  \psline{->}(0,0)(390,0)
  \psline{->}(0,-1.1)(0,1.1)
  \psplot[plotstyle=LineToYAxis,linestyle=dashed,plotpoints=50,
            showpoints=true]{0}{360}{x cos}
\end{pspicture}

\end{document}




More information about the PSTricks mailing list