[pstricks] Using variable options in pst-func
Emili García Ladona
emilio at icm.csic.es
Mon Sep 1 11:37:51 CEST 2014
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}
\multido{\ir=1+1,\rp=0.25+0.05}{4}{%
\edef\kp{\parametro(\ir)}
\edef\kc{\colo(\ir)}
\rput(2.2,\rp){k = \parametro(\ir)}
\psline[linecolor=\kc,linewidth=1.5pt](3.5,\rp)(4.5,\rp)
\psTDist[linecolor=\kc,nue=\kp]{-5}{5}}
\end{psgraph}
This code gives many errors related with the way I pass options to
\psTDist. After reading many manuals and similar questions I circumvented
the problem as
\newarray\parametro
\readarray{parametro}{1&2&5&10}
\newarray\colo
\readarray{colo}{black&orange&cyan&red}
\multido{\ir=1+1,\rp=0.25+0.05}{4}{%
\rput(2.2,\rp){k = \parametro(\ir)}
\checkparametro(\ir)
\edef\kk{\cachedata}
\checkcolo(\ir)
\psline[linecolor=\cachedata,linewidth=1.5pt](3.5,\rp)(4.5,\rp)
\psTDist[linecolor=\cachedata,nue=\kk]{-5}{5}}
So my question is why the first code does not work. Is there a compact
an/or systematic way to get variable [options] in pstricks commands from
arrays, something like [linecolor=\myarray(\i)], I have only see some
cases where colors are defined according to \multido indexes but in my
case color are simple named colors and
what about other numerical parameters as [nue=\parametro(\i)]
Thanks in advanced for comments or help
EMILIO
More information about the PSTricks
mailing list