refresh embedded plot

Hi, I?m new to matplotlib. I?m writing a program using

    > wxPython. The purpose of it is to insert some prices in a
    > form and get a plot of them in a graph inside the main
    > window. Is it possible to refresh the graph with the new
    > values after a button is pushed? How? Thank you very
    > much. DG

You want to define some function that updates the data in your plot
and then calls canvas.draw(). You can then connect that callback to
the clicked event of your button.

See, for example, in the matplotlib examples
directory, which does just this (thanks Andrew!)


Thank you very much for your advice.
Unfortunately when I try to run the script I get:

  File "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\",
line 310, in RunScript
    exec codeObject in __main__.__dict__
  File "C:\Python24\MathPlot_examples\examples\",
line 156, in ?
    app = MyApp(0)
  File "C:\Python24\Lib\site-packages\wx-2.5.3-msw-ansi\wx\",
line 5301, in __init__
  File "C:\Python24\Lib\site-packages\wx-2.5.3-msw-ansi\wx\",
line 4980, in _BootstrapApp
    return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "C:\Python24\MathPlot_examples\examples\",
line 111, in OnInit
    self.panel = XRCCTRL(self.frame,"MainPanel")
  File "C:\Python24\Lib\site-packages\wx-2.5.3-msw-ansi\wx\",
line 203, in XRCCTRL
    return window.FindWindowById(XRCID(str_id))
AttributeError: 'NoneType' object has no attribute 'FindWindowById'

Which frankly I don´t understand. Any further advice?
Thank you,