matplotlib/matplotlib — Issue #594: Multiple y-axis glitch when using SubplotHost
Author: nbigaouette
Created: 2011-11-16 20:27:59+00:00
State: open

I want to adapt the multiple y-axis example located at http://matplotlib.sourceforge.net/examples/pylab_examples/multiple_yaxis_with_spines.html to use mpl_toolkits.axes_grid1.parasite_axes.SubplotHost (since this is what I use with a transformation).

The following simple code adapted from the example shows the glitch:
```python
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost

def make_patch_spines_invisible(ax):
ax.set_frame_on(True)
ax.patch.set_visible(False)
for sp in ax.spines.itervalues():
sp.set_visible(False)

fig = plt.figure()
fig.subplots_adjust(right=0.75)

# No glitch:
#host = fig.add_subplot(111)
# Glitch:
#host = SubplotHost(fig, 1, 1, 1)
#fig.add_subplot(host)
# Glitch:
host1 = SubplotHost(fig, 1, 1, 1)
host = fig.add_subplot(host1)

par2 = host.twinx()

# Offset the right spine of par2. The ticks and label have already been
# placed on the right by twinx above.
par2.spines["right"].set_position(("axes", 1.2))
# Having been created by twinx, par2 has its frame off, so the line of its
# detached spine is invisible. First, activate the frame but make the patch
# and spines invisible.
make_patch_spines_invisible(par2)
## Second, show the right spine.
par2.spines["right"].set_visible(True)

plt.show()
```

Using "host = fig.add_subplot(111)" as in multiple_yaxis_with_spines.py example works: the third spine is on the right of the figure with the labels at the right of the spine. Using SubplotHost though the spine is a the right of the figure but the axis labels are at the left, overwritting the first y-labels. I'll try to attach a screenshot.