- #1
- 908
- 572
- TL;DR Summary
- A user-defined Mathematica function returns a list (array) of functions. How to plot them in different colors?
If we plot a list of functions in a literal array, they get plotted automatically in different colors, for example:
Plot [{x,x*x,-x},{x,0,10}]
But if we get the list of functions from another user-defined function, they get plotted in a single color:
fnY[x_]:={x, x*x, -x} ... OR ... fnY[x_] := List[x, x*x, -x]
Plot[fnY[x],{x,0,10}]
... even though fnY[x] evaluates to the same array as the literal array in the first example.
Why? How can we apply different colors to an array of functions constructed in a function?
Plot [{x,x*x,-x},{x,0,10}]
But if we get the list of functions from another user-defined function, they get plotted in a single color:
fnY[x_]:={x, x*x, -x} ... OR ... fnY[x_] := List[x, x*x, -x]
Plot[fnY[x],{x,0,10}]
... even though fnY[x] evaluates to the same array as the literal array in the first example.
Why? How can we apply different colors to an array of functions constructed in a function?