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


Groups > comp.soft-sys.math.mathematica > #6429

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

From Peter Pein <petsie@dordos.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: how to plot new data points to pre-existing figure
Date 2011-11-14 12:06 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j9r08m$bc3$1@smc.vnet.net> (permalink)
References <j9o3j9$15$1@smc.vnet.net>

Show all headers | View raw


Am 13.11.2011 10:45, schrieb tle:
> 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++];
>    ]
>

Try PrintTemporary:

testPlot[k_] :=
  Module[{i, n, m, z, tmp = PrintTemporary[""], plot1},
   z[x_, m_] = m*x;
   For[i = 1, i < k,
    plot1 =
     Plot[z[x, i], {x, 0, 10}, PlotRange -> {{0, 10}, {0, 20}},
      PlotLabel -> Style["i == " <> ToString[i], 12]];
    NotebookDelete[tmp];
    tmp = PrintTemporary[plot1];
    Pause[1];
    i++];
   plot1
   ]

testPlot[3]

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

how to plot new data points to pre-existing figure tle <truongvle@yahoo.com> - 2011-11-13 09:45 +0000
  Re: how to plot new data points to pre-existing figure Peter Pein <petsie@dordos.net> - 2011-11-14 12:06 +0000
  Re: how to plot new data points to pre-existing figure "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-14 12:11 +0000

csiph-web