Re: Plot Table of functions does not distinguish colors
- To: mathgroup at smc.vnet.net
- Subject: [mg102703] Re: Plot Table of functions does not distinguish colors
- From: "M.Roellig" <markus.roellig at googlemail.com>
- Date: Thu, 20 Aug 2009 04:55:19 -0400 (EDT)
- References: <h6duj1$h9f$1@smc.vnet.net>
Hi, It is explained in the documentation that Plot[f,{x,xmin,xmax}] has attribute HoldAll, and evaluates f only after assigning specific numerical values to x, so Plot only sees a single function as argument, since the HoldAll initially prevents the Table function to set up the list of functions. Use Evaluate: Plot[Evaluate@Table[Sin[n x], {n, 1, 3, 1}], {x, 0, 2 Pi}, PlotRange - > All, PlotStyle -> Thick] Cheers, Markus On Aug 18, 12:08 pm, fd <fdi... at gmail.com> 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