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

MathGroup Archive 2011

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122876] Re: how to plot new data points to pre-existing figure
  • From: Peter Pein <petsie at dordos.net>
  • Date: Mon, 14 Nov 2011 07:06:02 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j9o3j9$15$1@smc.vnet.net>

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]



  • Prev by Date: Re: Generating Word Documents from Mathematica
  • Next by Date: Re: large integration result for simple problem: 1/x,, also BesselJ
  • Previous by thread: Re: how to plot new data points to pre-existing figure
  • Next by thread: Re: how to plot new data points to pre-existing figure