For the following, the variable \mystyle doesn't work as expected.
Therefore, how can I:
1- optimize the code by making three lists of values of \myalph, \mystyle, and \mylabel to be iterated over by foreach instead of typing the combinations one-by-one,
2- then fix the code to make \mystyle work as a line style option?
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\pgfplotsset{alph/.initial=1}
\newcommand*{\getalph}{\pgfkeysvalueof{/pgfplots/alph}}
\begin{tikzpicture}[
declare function = { CFDfixedalph(\time) = \time^(\getalph-1); } ]
\begin{semilogxaxis}
\foreach \myalph/\mylabel/\mystyle in {0.1/{one}/dashed , 0.5/{two}/solid , 0.9/{three}/red}{
\addplot[alph=\myalph, domain = 1e-6 : 1e6, samples = 100, \mystyle] {CFDfixedalph(x)};
\addlegendentryexpanded{\mylabel}
}
\end{semilogxaxis}
\end{tikzpicture}
\end{document}

\edef\temp{\noexpand...? and why did it end withtempbefore\addlegendentryexpanded? – Diaa Aug 27 '19 at 13:45\addplotare expanded, and then the\addplotcommand. Note that pgfplots comes withTeX-programming-notes.pdf, where this is explained better than I could explain it. – Aug 27 '19 at 14:52