From: Kevin H. <kho...@ro...> - 2006-08-20 00:13:16
|
I've got a series of subplots in a matplotlib.FigureCanvas instance which is embedded in a gtk viewport. Everything seems to work correctly when I start the application - i.e. the series of subplots are displayed. But, I need to be able to interactively change the axis settings by clicking on GTK buttons. I have not yet figured out how to make the subplots redraw after changing the axis settings. Based on the dynamic_image_gtkagg.py example, I have done the following (code not complete here): f = Figure(figsize=(5,4), dpi=100) canvas = FigureCanvas(f) manager = pylab.get_current_fig_manager() and later, when I need to redraw the subplots: manager.canvas.draw() But, although I have confirmed that the axis settings are changed, the subplots are not redrawn using the new settings. Any hints would be greatly appreciated. Kevin Horton Ottawa, Canada |
From: Kevin H. <kho...@ro...> - 2006-08-20 01:17:45
|
On 19 Aug 2006, at 20:13, Kevin Horton wrote: > I've got a series of subplots in a matplotlib.FigureCanvas instance > which is embedded in a gtk viewport. Everything seems to work > correctly when I start the application - i.e. the series of > subplots are displayed. But, I need to be able to interactively > change the axis settings by clicking on GTK buttons. I have not > yet figured out how to make the subplots redraw after changing the > axis settings. > > Based on the dynamic_image_gtkagg.py example, I have done the > following (code not complete here): > f = Figure(figsize=(5,4), dpi=100) > canvas = FigureCanvas(f) > manager = pylab.get_current_fig_manager() > > and later, when I need to redraw the subplots: > > manager.canvas.draw() > > But, although I have confirmed that the axis settings are changed, > the subplots are not redrawn using the new settings. > > Any hints would be greatly appreciated. I'd been working on this all day, with no progress. But I finally hit the gold mine with Google. I needed to change the draw command to: f.canvas.draw() Now my application appears to be working correctly. The previous version was not triggering any errors, but it was not working. Kevin Horton Ottawa, Canada |