Re: Plot Table of functions does not distinguish colors

*To*: mathgroup at smc.vnet.net*Subject*: [mg102701] Re: Plot Table of functions does not distinguish colors*From*: Szabolcs Horvát <szhorvat at gmail.com>*Date*: Wed, 19 Aug 2009 07:03:40 -0400 (EDT)*References*: <h6duj1$h9f$1@smc.vnet.net>

On 2009.08.18. 12:08, fd wrote: > All, this seems like a simple question, but when I want to create a > table with different function as in the example > > Plot[Table[Sin[n x], {n, 1, 3, 1}], {x, 0, 2 Pi}, PlotRange -> All, > PlotStyle -> Thick] > > I get all three plots with the same color. If I instead write the > table manually > > Plot[{Sin[x], Sin[2 x], Sin[3 x]}, {x, 0, 2 Pi},PlotStyle->Thick] > > This gives a different plot with a different color for each plot. > > Can anyone shed some light on why this behavior? In the first version, only one expression is passed to Plot[], not a list of expressions. For some reason Plot[] does not notice that this expression is going to evaluate to a list when it chooses the palette. The solution is to evaluate the expression manually, or ask Plot[] to evaluate it before substituting any values for x: Plot[Table[Sin[n x], {n, 3}] // Evaluate, {x, 0, 2 Pi}, PlotStyle -> Thick] Plot[Table[Sin[n x], {n, 3}], {x, 0, 2 Pi}, PlotStyle -> Thick, Evaluated -> True]