MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Plot Table of functions does not distinguish colors


Hi,

Table has the attribute HoldAll which means that it doesn't see from the
start a list of functions. When it finally evaluates the Table to a List
it is too late to paint it differently. The trick is to evaluate the
Table manually:

Plot[Evaluate@Table[Sin[n x], {n, 1, 3, 1}], {x, 0, 2 Pi}, 
 PlotRange -> All, PlotStyle -> Thick]

Cheers
Patrick

On Tue, 2009-08-18 at 06:09 -0400, 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?
> 
> Best
> 



  • Prev by Date: Re: Plot Table of functions does not distinguish colors
  • Next by Date: Re: ParrallelDo and set::noval
  • Previous by thread: Re: Plot Table of functions does not distinguish colors
  • Next by thread: Re: Plot Table of functions does not distinguish colors