Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6442 > unrolled thread

Re: how to plot new data points to pre-existing figure

Started byHeike Gramberg <heike.gramberg@gmail.com>
First post2011-11-14 12:14 +0000
Last post2011-11-14 12:14 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: how to plot new data points to pre-existing figure Heike Gramberg <heike.gramberg@gmail.com> - 2011-11-14 12:14 +0000

#6442 — Re: how to plot new data points to pre-existing figure

FromHeike Gramberg <heike.gramberg@gmail.com>
Date2011-11-14 12:14 +0000
SubjectRe: how to plot new data points to pre-existing figure
Message-ID<j9r0n1$bit$1@smc.vnet.net>
You could do something like this (note that the Pause[.5] is just to slow things down a bit)

testPlot[k_] := Module[{i, z},
  z[x_, m_] := m*x;
  Monitor[For[i = 1, i < k,
    plot1 =
     Plot[z[x, i], {x, 0, 10}, PlotRange -> {{0, 10}, {0, 20}},
      ImageSize -> 300];
    Pause[.5];
    i++],
   Column[{i, plot1}]];
  Column[{i, plot1}]]

This is useful for long calculations where you want to plot the intermediate result. If you just want to animate a list of graphs, you might want to use Animate or ListAnimate e.g.

testPlot1[k_] := Module[{z},
  z[x_, m_] := m*x;
  Animate[Column[{i,
     Plot[z[x, i], {x, 0, 10}, PlotRange -> {{0, 10}, {0, 20}},
      ImageSize -> 300]}], {i, 1, k - 1, 1}]]

Heike.


On 13 Nov 2011, at 10:43, tle wrote:

> Hi,
>
> Could someone please tell me how to delete the old figure and create a new one in a for loop.
>
> thanks,
>
> testPlot[k_] := Module[{i, n, m, z},
>  z[x_, m_] = m*x;
>  For[i = 1, i < k,
>   Print[{i}];
>   plot1 =
>    Plot[z[x, i], {x, 0, 10}, PlotRange -> {{0, 10}, {0, 20}}];
>   Print[plot1];
>    i++];
>  ]
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web