I've realized that using the ParasiteAxes from the mpl_toolkits should do
exactly what I'm asking. However, I am having a problem with callbacks when
the x and y limits change (try resizing the window). The following script
shows that the callback for the second set of axes is not carried out. Is
There was a typo in the script, the callbacks should be
ax.name = first axis
ax.callbacks.connect('xlim_changed',check_callback)
ax.callbacks.connect('ylim_changed',check_callback)
ax2 = ax.twin()
ax2.name = second axis
ax2.callbacks.connect('xlim_changed',check_callback)
ax.twin returns a ParasiteAxesAuxTrans instance which is derived from
the mpl's original Axes, but only drawing-related methods are meant to
be meaningful. For example, this axes is never meant to be added to
the figure and the draw method of this axes is never meant to be
called. I haven't looked
Hello,
I want to create two sets of axes for a figure that would be
equivalent to
ax = fig.add_subplot(111)
ax2 =
ax
.figure
.add_axes(ax.get_position(True),frameon=False,sharex=ax,sharey=ax)
except that I want to be able to specify different tick locators and
formatters for ax and ax2.