graph tool and pyplot

I am trying to utilize some of the functionality that pyplot provides to
display some data related to the graph, but on a separate window.

The problem I have is that the pyplot window that pops up is uncontrollable,
in other words I can not utilize any of the default buttons, or even close
it.

The code I use is very simple:
        plt.ion()
        fig = plt.figure()
        ax = self.fig.add_subplot(111)
        x = np.random.normal(0,1,1000)
        numBins = 50
        ax.hist(x,numBins,color='green',alpha=0.8)

Any ideas what is going on? Can it be that Gtk and pyplot don't work well
together?

thanks in advance

I'm not sure what this hast to do with graph-tool. Do things work as
expected when you do not import graph-tool?

Best,
Tiago

Tiago,

I am 100% sure it has nothing to do with the graph tool but rather with Gtk
backend. I should have probably mentioned that in my first email.
The only reason I posted it on the mailing list was because I am sure I
can't be the only one who wants to use pyplot from a Gtk-based app that
uses the graph-tool.
So I was kinda looking for some hints, if anybody has any.

Vaggelis

attachment.html (2.29 KB)

You might want to try asking matplotlib to use another backend : (ex qt4)
     import matplotlib
     matplotlib.use('QT4Agg')

or, as graph_tool uses gtk3 if I remember correctly, you try to force
the import of gtk, see if it helps... (maybe you have two versions of
gtk that generate conflicts)

Good luck.

I have absolutely no problem using matplotlib with the Gtk+ backend
together with graph-tool.

You should bring this to the matplotlib mailing list/issue tracker
instead.

Best,
Tiago

Do you import the drawing canvas as a widget to a Gtk window or do you use
it directly as is (i.e. invoke plot() and be done with it?)
And if you don't mind me asking, which backend are you using, GtkAgg?

attachment.html (1.5 KB)

Do you import the drawing canvas as a widget to a Gtk window or do you
use it directly as is (i.e. invoke plot() and be done with it?)

I use it as it is.

And if you don't mind me asking, which backend are you using, GtkAgg?

I use GTK3Cairo.

Please, since his has nothing to do with graph-tool, this is totally
off-topic for this list. You should contact the matplotlib community.

Best,
Tiago