I’m trying to do a twiny setup on one of the Axes generated from a make_axes_locatable().append_axes() call. The new axis generated from twiny() seems to span the entire window though. Here’s the code:

from matplotlib.pyplot import *

import numpy as np

from mpl_toolkits.axes_grid1 import make_axes_locatable

ax_c = subplot(111)

ax_c.plot(np.linspace(0,10))

divider = make_axes_locatable(ax_c)

ax_t = divider.append_axes(“top”, size=1.2, pad=0.1, sharex=ax_c)

ax_r = divider.append_axes(“right”, size=1.2, pad=0.1, sharey=ax_c)

ax_r.plot(np.linspace(0,50))

ax_t.plot(np.linspace(0,25))

ax_ty = ax_r.twiny()

ax_ty.plot(np.linspace(-50,0))

show()

If you get the idea of what I’m trying to do, other suggestions involving AxesGrid, subplots, or otherwise are welcome. AxesGrid seems to require that I have all four plots in a 2x2 grid (in the above code there are only 3), and using subplots would seemingly require the rightmost plot to span the height of the other two. There’s this: http://matplotlib.org/examples/pylab_examples/scatter_hist.html but I don’t want to hard-code the dimensions, as the center subplot should change dimensions as I put in new data…