I have a function that takes a numeric argument and returns a list of numbers. I want to plot each element of the list in a different color.
If I use this command,
Plot[f[x],{x,-1,1}]
all the elements are plotted in the same color. The function takes only a numeric argument (its definition is f[x_?NumericQ]:=...
) so I can't use Evaluate
like in this question.
So far I've been using this command:
Plot[{f[x][[1]],f[x][[2]],f[x][[3]],f[x][[4]]},{x,-1,1}]
Which works fine (since the function evaluates very fast, I don't mind there are redundant evaluations here, see this question). However this is not very elegant, and considering I have 16 elements to plot, it gets downright ugly.
Is there a more elegant way to plot each element in a different color?
Plot[Evaluate[f[x]], ...]
? $\endgroup$ – wxffles Nov 14 '12 at 19:08f[x_?NumericQ]:=...
(as indicated in the question) then that doesn't work. $\endgroup$ – acl Nov 14 '12 at 19:19