MathGroup Archive 2008

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

Search the Archive

Re: Draw two functions in a graph, one of them does also

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90246] Re: Draw two functions in a graph, one of them does also
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Thu, 3 Jul 2008 06:12:01 -0400 (EDT)

On 7/2/08 at 5:28 AM, murray at math.umass.edu (Murray Eisenberg) wrote:

>Add an option if you wish that makes the zero function (when a==0)
>be more visible:

>Plot[{f[x], Table[g[a][x], {a, 0, 3}]}, {x, 0, 1},PlotStyle->Thick]

>That plots f in one color and the several g[a] in a second
>color. If you want automatic coloring with more than two
>colors, you could
>do this:

>Plot[Evaluate@{f[x], Table[g[a][x], {a, 0, 3}]}, {x, 0, 1}]

>(I don't know why the Evaluate does this!)

When you use Evaluate, the Table part of the expression gets
evaluated to a list *before* Plot assigns values to x.
Consequently, Plot sees a list of functions to be plotted and
they get plotted in different colors.

When you omit Evaluate, Plot provides a specific value for x
then Table does its thing. The result is Plot sees a single
multi-valued function which it plots in a single color.


  • Prev by Date: Re: Problem with parametric minimization
  • Next by Date: Differing curvature measures in NonlinearRegress
  • Previous by thread: Re: Draw two functions in a graph, one of them does also
  • Next by thread: Re: more inset export problems