I am doing the Taylor series of sin function by using this code:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=-3.14:3.14,samples=100,smooth,no markers,axis lines=middle,ymax=2,ymin=-2,xlabel=$x$,ylabel=$y$]
\addplot[thick,color=orange,domain=-3.14:3.14] {sin(deg(x))};
\def\myfun{0}
\pgfplotsforeachungrouped \nn in {0,1,2,3,4}
{\edef\myfun{\myfun+((-1)^(\nn))*pow(x,2*\nn+1)/factorial(2*\nn+1)}
\addplot+{\myfun};
}
\end{axis}
\end{tikzpicture}
\end{document}
I would like to customise the options of colors in each new term inserted in the series (tones of blue), specify the width of line, etc.... Moreover, I would like to insert a legend each time a new parcell is inserted. How can I do this, please?

sumfunction from here. – May 04 '20 at 16:38pgfplotstablefunctions to build up such sums. (And I had upvoted your question some time ago, but at that point I did not understand how powerful\pgfmathdeclarefunctionreally is. These functions can be used everywhere where TikZ parses expressions, also in coordinates and so on.) – May 04 '20 at 16:44