Re: pgfplots e parametri nelle opzioni di \addplot

#71648
Up
0
Down
::


Leggermente più compatto:
`\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}
\def\n{10}
\pgfmathsetmacro{\fine}{\n-1}
\foreach \i in {0,…,10} {
\pgfmathparse{int(2*\i+1)};
\let\y\pgfmathresult
\addplot table[x index=0, y index=\y] {file.dat};
}
\end{axis}
\end{tikzpicture}
\end{document}`
Non so perchè, ma se si utilizza [tt]\def[/tt] al posto di [tt]\let[/tt] la compilazione si arresta con un errore
`! Package pgfplots Error: Sorry, the requested column number '2Y7.0e0]' in tabl
e 'file.dat' does not exist!? Please verify you used the correct index 0 <= i < N..` lo stesso se si usa direttamente [tt]\pgfmathresult[/tt] per indicare la colonna. Evidentemente [tt]\let[/tt] fa qualcosa al risultato che [tt]\def[/tt] non fa. Ciao Fra

Go to top