AxesGrid and add_axes

Hi guys,

I made a class which create a special plot in the parent figure
(matplotlib.pyplot.figure) given as a argument to the __init__ method.

To show more than one instance of this class in the matrix I make a grid
(mpl_toolkits.axes_grid.AxesGrid) and initialize the class with proper element
of this grid instead of the figure class instance.
Naturely this does not work, because this grid element
(mpl_toolkits.axes_grid1.axes_divider.LocatableAxes) is not inherent from the
matplotlib.pyplot.figure class, so the methods are different.
Problematic part of my code is line: axe2D = self.figure.add_axes(rect), where
self.figure represents the 'parent area'.

Do you have any idea, howto solve this incompatibility?


A figure is a figure and an axes is an axes. They are NOT
interchangeable. The AxesGrid essentially creates a list of axes.

As you may already know, only figure class has an add_axes method. And
axes can only be added to a figure. You cannot add an axes to another

Since I have no idea what kind of special plot your code creates, I
can only suggest you to revise your code to take an axes instance as
an input, not a figure instance.

If you can, please post a simple, but complete code that demonstrate
your problem.