Re: PlotStyle will not distribute over Table
- To: mathgroup at smc.vnet.net
- Subject: [mg96653] Re: PlotStyle will not distribute over Table
- From: dh <dh at metrohm.com>
- Date: Wed, 18 Feb 2009 06:00:40 -0500 (EST)
- References: <gngk0g$jj0$1@smc.vnet.net>
Hi Kresimir, Plot has the attribute HoldAll. Therefore Table is not evaluated before being fed to Plot. This makes Plot think that there is only one curve. You may improve this by wrapping Table[..] into Evaluate to enforce evaluation before plotting. There is another reason you should do this, otherwise Table is evaluated for every point of your plot. hope this helps, Daniel Kresimir Kumericki wrote: > I create several functions using Table and want to plot them > on the same plot with different styles. However, it seems that > the last style in the list of PlotStyle options is used for all > the lines. E.g. > > Plot[Table[Sin[a x], {a, 1, 2}], {x, 0, Pi}, > PlotStyle -> {Hue[0.7], Hue[1]}] > > will have both lines with red color, while > > Plot[{Sin[ x], Sin[2 x]} , {x, 0, Pi}, > PlotStyle -> {Hue[0.7], Hue[1]}] > > works correctly. Any idea how to make first version work? > (I have Mathematica 6.0) > > Kresimir > >