[pstricks] Graphing function containing a parameter

Poul Riis Poul.Riis at skolekom.dk
Sun Sep 18 14:56:13 CEST 2005


Everything now seems to work - except with respect to a minor error that I
didn't mention before. For each call of the \plotfunctionwithoneparameter
procedure there seems to be a small horisontal displacement of the graph.
How can I avoid that?

\listfiles
\documentclass{article}
\usepackage{pstricks-add}
\pagestyle{empty}
\SpecialCoor

\newcommand{\plotfunctionwithoneparameter}[9]{%
   \pstVerb{/#4 #5 def
     /f { #4 mul sin } def
     /g { sin #4 add} def }
   \psset{linecolor=#9}%
   \psplot[plotpoints=100]{#2}{#3}{x #1}%
   \pnode(!#6 #6 #1){Q}%
   \rput[tr](!#6 #7 add #6 #1 #8 add)%
     {\rnode{P}{\color{#9}\psframebox[linecolor=#9]{$#4=#5$}}}
   \ncarc[nodesep=2pt,linecolor=#9]{->}{P}{Q}}

\begin{document}

\psset{xunit=0.2mm,yunit=2.5cm}
\begin{pspicture}(0,-1)(360,2)
\psaxes[Dx=60,Dy=0.5,linewidth=1pt,labels=all,%
     ticksize=-3pt 0]{->}(0,0)(0,-1)(360,2)%
\plotfunctionwithoneparameter{f}{0}{360}{w}{2}{60}{50}{1.1}{red}%
\plotfunctionwithoneparameter{f}{0}{360}{w}{3}{150}{50}{0.9}{green}%
\plotfunctionwithoneparameter{f}{0}{360}{w}{5}{90}{50}{1.2}{blue}%
\end{pspicture}

\end{document}

Yours,
Poul Riis




More information about the PSTricks mailing list