Imagine a very simple PGFPlot, e.g.:
\begin{tikzpicture}
\begin{axis}
\addplot+[no marks]{x^2};
\end{axis}
\end{tikzpicture}
How can I have the line "fade out" from the left to the right of the axis? I.e., how can I gradually vary the opacity of the line depending on the position on the x-axis?
I have managed to achieve this with the markers on a scatter plot with the following code:
\begin{tikzpicture}
\begin{axis}[
scatter/@pre marker code/.code= {\expandafter\scope\expandafter[opacity=0.1+\pgfplotspointmetatransformed/1000]},
scatter/@post marker code/.code={\endscope},
]
\addplot+[scatter, only marks] {x^2};
\end{axis}
\end{tikzpicture}
But I cannot do it with a "no marks" line plot. Ideally, I would like the colour of the line to be defined by the cycle list (rather than having to use a custom made gradient).