So I looked into it and the reason calling the show method for a Figure/FigureManager causes the figure to be visible only for an instant is that, at least in the case for tkagg, there is no call to a function that blocks until the figure window is closed and as a result the figure is displayed then the call to show ends, the figure closes, and the program moves on. This is in contrast to the behavior of the callable object invoked by pyplot.show() which calls a mainloop method to block. Since I am not super familiar with the internals of Matplotlib I am not sure the best way to fix this, but one option, in the case of tkagg, is to add a call to tk.mainloop() to the end of FigureManagerTkAgg.show() as is done in tkagg's Show object.

Just my 2 cents


On 1/16/13 10:23 AM, Benjamin Root wrote:


On Wed, Jan 16, 2013 at 5:50 AM, Kelson Zawack <k...@cornell.edu <mailto:k...@cornell.edu>> wrote:

    Ok, I understand about agg, but I am still a bit confused.  First
    when I run the suggested code using whatever the default backend
    is the figure is only displayed for a second and then it goes away
    and the program ends.  I guess what I am really interested in is
    what plt.figure() does.  It seems to be creating a figure manager
    which has a canvas and a figure in it, but which one of these is
    responsible for the showing/saving to file?

    Thanks for your help


If the plot only appears for a moment, then that would be a bug. Could you double-check which version of matplotlib you are running?

Ben Root

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to