inset_locator.inset_axes creates an inset axes whose size is either fixed, or a fixed proportion of the parent axes:

inset_axes = inset_axes(parent_axes,
width="30%",  # width = 30% of parent_bbox
height=1.,  # height = 1 inch
loc='lower left')
inset_locator.zoomed_inset_axes creates an inset axes whose data scale is that of the parent axes multiplied by some factor, e.g.

inset_axes = zoomed_inset_axes(ax,
0.5,  # zoom = 0.5
loc='upper right')
inset_locator.inset_axes creates an inset axes whose size is either fixed, or a fixed proportion of the parent axes:

inset_axes = inset_axes(parent_axes,
width="30%",  # width = 30% of parent_bbox
height=1.,  # height = 1 inch
loc='lower left')
inset_locator.zoomed_inset_axes creates an inset axes whose data scale is that of the parent axes multiplied by some factor, e.g.

inset_axes = zoomed_inset_axes(ax,
0.5,  # zoom = 0.5
loc='upper right')
RGBAxes is a helper class to conveniently show RGB composite images. Like ImageGrid, the location of axes are adjusted so that the area occupied by them fits in a given rectangle. Also, the xaxis and yaxis of each axes are shared.

from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes

fig = plt.figure()
ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8], pad=0.0)
r, g, b = get_rgb()  # r, g, b are 2D images.
ax.imshow_rgb(r, g, b)
Here, we demonstrate how to achieve the following layout: we want to position axes in a 3x4 grid (note that Divider makes row indices start from the bottom(!) of the grid):

+--------+--------+--------+--------+
| (2, 0) | (2, 1) | (2, 2) | (2, 3) |
+--------+--------+--------+--------+
| (1, 0) | (1, 1) | (1, 2) | (1, 3) |
+--------+--------+--------+--------+
| (0, 0) | (0, 1) | (0, 2) | (0, 3) |
+--------+--------+--------+--------+
These constraints are specified using classes from the axes_size module, namely:

from mpl_toolkits.axes_grid1.axes_size import Fixed, Scaled
vert = [Fixed(2), Scaled(2), Scaled(3)]
The Scatter plot with histograms example can be rewritten using make_axes_locatable:

axScatter = plt.subplot()
axScatter.scatter(x, y)
axScatter.set_aspect(1.)

# create new axes on the right and on the top of the current axes.
divider = make_axes_locatable(axScatter)
axHistx = divider.append_axes("top", size=1.2, pad=0.1, sharex=axScatter)
axHisty = divider.append_axes("right", size=1.2, pad=0.1, sharey=axScatter)

# the scatter plot:
# histograms
bins = np.arange(-lim, lim + binwidth, binwidth)
axHistx.hist(x, bins=bins)
axHisty.hist(y, bins=bins, orientation='horizontal')
We use these constraints to initialize a Divider object:

rect = [0.2, 0.2, 0.6, 0.6]  # Position of the grid in the figure.
vert = [Fixed(2), Scaled(2), Scaled(3)]  # As above.
horiz = [...]  # Some other horizontal constraints.
divider = Divider(fig, rect, horiz, vert)
Users typically do not need to directly instantiate dividers by calling AxesDivider; instead, make_axes_locatable can be used to create a divider for an axes:

ax = subplot(1, 1, 1)
divider = make_axes_locatable(ax)
twin without a transform argument assumes that the parasite axes has the same data transform as the host. This can be useful when you want the top(or right)-axis to have different tick-locations, tick-labels, or tick-formatter for bottom(or left)-axis.

ax2 = ax.twin() # now, ax2 is responsible for "top" axis and "right" axis
ax2.set_xticks([0., .5*np.pi, np.pi, 1.5*np.pi, 2*np.pi],
labels=["0", r"$\frac{1}{2}\pi$",
r"$\pi$", r"$\frac{3}{2}\pi$", r"$2\pi$"])
and make it responsible for locating the axes:

ax.set_axes_locator(locator)