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: [mg96650] Re: PlotStyle will not distribute over Table
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 18 Feb 2009 06:00:07 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <gngk0g$jj0$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

and because Plot[] has the attribute HoldAll, it can't find out
that

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

has a List[] as result and so it handle it as a single function
and not as a list of functions. The single function is colored in one
color, a list of functions in different colors. So you must enable
Mathematica to detect that you have a list of functions and write

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

Regards
   Jens

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
> 
> 


  • Prev by Date: Re: PlotStyle will not distribute over Table
  • Next by Date: contract selection in front end
  • Previous by thread: Re: PlotStyle will not distribute over Table
  • Next by thread: Re: PlotStyle will not distribute over Table