MathGroup Archive 2011

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

Search the Archive

Re: Plot function with two arguments

  • To: mathgroup at
  • Subject: [mg122115] Re: Plot function with two arguments
  • From: "Oleksandr Rasputinov" <oleksandr_rasputinov at>
  • Date: Sat, 15 Oct 2011 06:02:27 -0400 (EDT)
  • Delivered-to:
  • References: <j79109$i3b$>

On Fri, 14 Oct 2011 10:56:25 +0100, Alexei Boulbitch  
<Alexei.Boulbitch at> wrote:

> "Remove Evaluate, and all the curves will be the same color."
> Why actually it behaves this way?
> This:
> f[x_, k_] := (k*x^2 - x)/(x - k);
> Plot[Table[f[x, k], {k, -3, 3}], {x, -20, 20}]
> indeed yields all lines of the same colour.  However, this:
> lst=Table[f[x, k], {k, -3, 3}];
> Plot[lst, {x, -20, 20}]
> returns the lines with different colours. I would appreciate, if one  
> explains the reason For such a behaviour.
> Thank you, Alexei

Plot has HoldAll. By the looks of it, a check is done to see if the first  
argument has head List; if so, Plot understands that it is being given a  
list of functions and colours them accordingly. If the Head is not List,  
though (for example, in this case it would be Table), Plot treats it as a  
single, vector-valued function, with all branches plotted using the same  

  • Prev by Date: Only real data
  • Next by Date: Problems plotting 3D surface and using manipulate
  • Previous by thread: Re: Plot function with two arguments
  • Next by thread: Fitting step function