Mathematica: How to update the same plot once it is created?



This seems like it should be easy to do, but I really think this is
impossible to do in Mathematica.

Here is the problem: I make a plot. The plot is shown and displayed ok. Now,
later on, I want to update the same plot, but NOT create a separate plot.
There does not seem a way to do this.

Here is an example:

p=Plot[Sin[x],{x,-Pi,Pi}]
....
....
.... Now, I want to make changes to the above plot
..... say I want to add something to it, or redraw it
..... how??

I do not want to create a new plot window (i.e do not want to create a new
Cell), I want the updates to go to the plot display above, i.e. physically
the same plot window in the same cell as it was, and not create a new plot
window.

I am trying to do some simulation (discrete event simulation, one queue one
server basic model) where I want to update the same plot as time ticks go
by. and I need to be able to update the same plot window from different
places in the code (as the system state changes) and not have to create a
new plot window each time.

I do not want to use Manipulate or Animate as they do not fit what I am
trying to do, I need to be able to better control this, and I do not want to
combine the plots and display them at the end, I need to update the plots
right away.

The above sort of thing is easy to do in Matlab and R (is it possible to do
in Maple?) but I am surprised how hard it is to do in Mathematica.

I hope I am overlooking something simple, and someone has a solution to this
one. I looked at may be using SelectionMove[] to select the cell where the
plot is in and such tricks, but I am not sure yet, I am still trying to see
if this will work.

thanks,
Nasser



.



Relevant Pages

  • Re: Basic queries on using LT Spice
    ... Basic queries on using LT Spice ... crosshairs over the wire to read the node ID below, ... Note that you single click a node to plot it. ... On a new schematic, or when you have closed the plot window, LT Spice ...
    (sci.electronics.cad)
  • Re: Basic queries on using LT Spice
    ... >> from the established LT Spice users could save me hours please! ... >crosshairs over the wire to read the node ID below, ... Note that you single click a node to plot it. ... >On a new schematic, or when you have closed the plot window, LT Spice ...
    (sci.electronics.cad)
  • Re: Basic queries on using LT Spice
    ... Basic queries on using LT Spice ... crosshairs over the wire to read the node ID below, ... Note that you single click a node to plot it. ... On a new schematic, or when you have closed the plot window, LT Spice ...
    (sci.electronics.design)
  • Re: Basic queries on using LT Spice
    ... >> from the established LT Spice users could save me hours please! ... >crosshairs over the wire to read the node ID below, ... Note that you single click a node to plot it. ... >On a new schematic, or when you have closed the plot window, LT Spice ...
    (sci.electronics.design)
  • Re: Mathematica: How to update the same plot once it is created?
    ... Here is the problem: I make a plot. ... I do not want to create a new plot window (i.e do not want to create a new ... Cell), I want the updates to go to the plot display above, i.e. physically ... but I am surprised how hard it is to do in Mathematica. ...
    (sci.math.symbolic)