[pstricks] Using variable options in pst-func

Herbert Voss Herbert.Voss at FU-Berlin.DE
Mon Sep 1 21:30:57 CEST 2014


Am 01.09.2014 11:37, schrieb Emili Garcí­a Ladona:
> Hi,
>  I'm not so experimented in pstricks. I have preparing some teaching
> material and trying to build graphs from some
> distribution functions using pst-func. The idea is to represent a
> function for different parameters for example
>  \psTDist[linecolor=xxxx,nue=xxx]{-5}{5}
> 
> In this case I have proposed the following code who draws 4 curves of 4
> different "linecolor" depending of "nue" values.
> 
> The code I tried was (except details on axis options draw four curves
> with four legends)
> 
> \begin{psgraph}[]{}
> \newarray\parametro
> \readarray{parametro}{1&2&5&10}
> \newarray\colo
> \readarray{colo}{black&orange&cyan&red}

Please provide _full working_ examples. How should one know
that you are using package arrajob or arrayjobx??
However, you can do it with the default PSTricks macros:

\documentclass{article}
\usepackage{pst-func}

\begin{document}
\newcounter{iA} \setcounter{iA}{1}
\begin{psgraph}[Dy=0.2]{->}(0,0)(-5.5,-0.1)(5.5,0.6){10cm}{10cm}
\pgfforeach \kp/\kc in {1/black,2/orange,5/cyan,10/red}{%
   \rput(!2.2 0.2 0.05 \theiA\space mul add){k=\kp}
   \psset{linecolor=\kc,linewidth=1.5pt}%
   \psline(!3.5  0.2 0.05 \theiA\space mul add)(!4.5  0.2 0.05
\theiA\space mul add)
   \psTDist[linecolor=\kc,nue=\kp]{-5}{5}
   \stepcounter{iA}%
}
\end{psgraph}

\end{document}

The macros of arrayjob are not expandable.

Herbert


More information about the PSTricks mailing list