Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: PlotStyle will not distribute over Table

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96662] Re: [mg96639] PlotStyle will not distribute over Table
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Thu, 19 Feb 2009 03:35:23 -0500 (EST)
  • Reply-to: hanlonr at cox.net

Attributes[Plot]

{HoldAll,Protected}

Since Plot has Attribute HoldAll, at the time PlotStyle gets evaluated there is a single entity (a Table) to Plot. Use Evaluate on the Table to force its evaluation earlier.

Plot[Evaluate[Table[Sin[a x], {a, 1, 2}]], {x, 0, Pi}, 
 PlotStyle -> {Hue[0.7], Hue[1]}]


Bob Hanlon

---- Kresimir Kumericki <kkumer at calculon.phy.hr> 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



--

Bob Hanlon



  • Prev by Date: Copying and Pasting and Inline Cells
  • Next by Date: Re: PlotStyle will not distribute over Table
  • Previous by thread: Re: PlotStyle will not distribute over Table
  • Next by thread: Re: PlotStyle will not distribute over Table