|
From: Kelson Z. <kb...@co...> - 2013-01-16 10:50:21
|
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 On 1/16/13 5:02 AM, Francesco Montesano wrote: > Hi Kelson, > > 2013/1/16 Kelson Zawack <kb...@co... <mailto:kb...@co...>> > > I want to create a matplotlib figure as part of a program I am writing > and therefore would like to create the figure in a fully object > oriented > way, ie not in the pyplot state-full way. I understand how to > work with > a figure object to create axes objects and then fill the axes objects > with primitive artists but I can't figure out what type of object > to put > the figure object in to get it displayed. > > using qt4agg for me this works (version 1.2.0) > fig = plt.figure() > ax = fig.add_subplot(111) > ax.plot([1,2]) > fig.show() > > From digging around in the > source it looks like the show() method comes from the backend, but > when > I looked in 'matplotlib/backends/backend_agg' I saw no such object. > What am I missing? I guess I could put the figure in a Qt window, > but I > like the functionality provided by the default matplotlib window. > > Thanks for the help > > > "agg" is not an interactive backend and is useful only when saving > figures > (http://matplotlib.1069221.n5.nabble.com/Backend-Agg-show-plot-td13162.html). > Thats why there is no show(). > e.g. qt4agg gets show from qt4 > > does this help? > > Francesco > > > > ------------------------------------------------------------------------------ > Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, > jQuery > and much more. Keep your Java skills current with LearnJavaNow - > 200+ hours of step-by-step video tutorials by Java experts. > SALE $49.99 this month only -- learn more at: > http://p.sf.net/sfu/learnmore_122612 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > <mailto:Mat...@li...> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |