ANN: matplotlib-0.82

John, Is there anything special required to get the subplot

    > configuration tool available from QtAgg? I'm in the process
    > of fixing that sizing problem reported last week and the only
    > way to fix it was to change how the toolbar layout works so
    > I'm mucking around in the toolbar right now.

    > I guess I'll sync and take a look at the Gtk backend and see
    > what happens in there...

Hi Ted,

It shouldn't be hard. The subplot configuration toolbar is a pure
matplotlib widget so all it requires id for your toolbar to embed it
into a properly sized qt canvas. This means your toolbar needs to
know how to make a canvas, so you need to subclass the toolbar gor
qtagg. What I did for GTK was add a "_get_canvas(self, fig)" method
to the toolbar.

The base class binds the new subplots.png button to
configure_subplots, which looks like this -- note the line marked with
the arrow

class NavigationToolbar2GTK(NavigationToolbar2, gtk.Toolbar):
   ...snip...

    def configure_subplots(self, button):
        toolfig = Figure(figsize=(6,3))
====> canvas = self._get_canvas(toolfig)
        toolfig.subplots_adjust(top=0.9)
        tool = SubplotTool(self.canvas.figure, toolfig)

        w = int (toolfig.bbox.width())
        h = int (toolfig.bbox.height())

        window = gtk.Window()
        window.set_title("Subplot Configuration Tool")
        window.set_default_size(w, h)
        vbox = gtk.VBox()
        window.add(vbox)
        vbox.show()

        canvas.show()
        vbox.pack_start(canvas, True, True)
        window.show()

    def _get_canvas(self, fig):
        return FigureCanvasGTK(fig)

Then in gtkagg, I subclass the toolbar with

class NavigationToolbar2GTKAgg(NavigationToolbar2GTK):
    def _get_canvas(self, fig):
        return FigureCanvasGTKAgg(fig)

You might want to try the same approach for qtagg. Of course there is
no FigureCanvasQt, but this approach will make it easier if someone
wants to add a different renderer to Qt, eg QtCairo.

JDH