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

MathGroup Archive 2012

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

Search the Archive

Re: Plotting in nested Manipulates

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124630] Re: Plotting in nested Manipulates
  • From: Chris Young <cy56 at comcast.net>
  • Date: Fri, 27 Jan 2012 06:11:30 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jfm07i$jtb$1@smc.vnet.net> <jforpv$6f9$1@smc.vnet.net>

Thanks very much, that fixes the problem.

On 2012-01-25 12:15:59 +0000, A Retey said:

> I think With is o.k., you are missing a Dynamic for the ListLinePlot,
> otherwise the ListLinePlot is evaluated too early, when the c[i] don't
> have values yet, and it will never be updated later:
> 
> Manipulate[
>   With[{
>     contents =
>      With[{values = Table[c[i], {i, 1, n}]},
>       Column[{values, Dynamic[ListLinePlot[values]]}]
>       ],
>     controls = Sequence @@ Table[{{c[i], i*0.1}, 0, 1, 0.1}, {i, 1, n}]
>     },
>    Manipulate[contents, controls]],
>   {n, 4, 10, 1}
>   ]
> 
> Now if you wonder why that is not necessary for the values in the first
> row of Column: ListLinePlot is a function that generates a Graphics, and
> that Graphics will not contain any of the c[i] anymore, since
> ListLinePlot dismissed the nonnumerical values. The following will
> create the graphics directly, and thus will be happy without the Dynamic:
> 
> Clear[c];
> 
> Manipulate[
>   With[{
>     contents = With[{values = Table[c[i], {i, 1, n}]},
>       Column[{
>         values,
>         Graphics[{Blue,
>           Line[Table[{k, values[[k]]}, {k, Length[values]}]]},
>          Frame -> True, AspectRatio -> 1/GoldenRatio]
>         }]
>       ],
>     controls = Sequence @@ Table[{{c[i], i*0.1}, 0, 1, 0.1}, {i, 1, n}]
>     },
>    Manipulate[contents, controls]],
>   {n, 4, 10, 1}
>   ]
> 
> 
> hth,
> 
> albert





  • Prev by Date: Re: NDSolve and DAEs
  • Next by Date: Re: Puzzled by Sum
  • Previous by thread: Re: Plotting in nested Manipulates
  • Next by thread: Compile function and AppendTo for lists (vrs. 8.0.4)