Repository navigation
Description
Bug report
Bug summary
Axis labels and ticks are being over plotted, i.e. plotted more than once when using ParasiteAxes and subplot host. This causes the output to appear bold along certain axes.
Code for reproduction
Modified version of https://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html to demonstrate location of over plotting.
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import matplotlib.pyplot as plt
host = host_subplot(111, axes_class=AA.Axes)
plt.subplots_adjust(right=0.75)
par1 = host.twinx()
par2 = host.twinx()
offset = 60
new_fixed_axis = par2.get_grid_helper().new_fixed_axis
par2.axis["right"] = new_fixed_axis(loc="right",
axes=par2,
offset=(offset, 0))
par2.axis["right"].toggle(all=True)
host.set_xlim(0, 2)
host.set_ylim(0, 2)
host.set_xlabel("X-Overplotted")
host.set_ylabel("Y-Overplotted")
par1.set_ylabel("Axis is fine")
par2.set_ylabel("Axis is fine")
p1, = host.plot([0, 1, 2], [0, 1, 2])
p2, = par1.plot([0, 1, 2], [0, 3, 2])
p3, = par2.plot([0, 1, 2], [50, 30, 15])
par1.set_ylim(0, 4)
par2.set_ylim(1, 65)
host.axis["left"].label.set_color(p1.get_color())
par1.axis["right"].label.set_color(p2.get_color())
par2.axis["right"].label.set_color(p3.get_color())
plt.draw()
plt.show()Actual outcome
As expected the x-axis and the left hand y-axis is bold due to over plotting.

This is also seen in the figure in the documentation from
https://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axisartist-with-parasiteaxes
Expected outcome
This appeared to work fine in Matplotlib 1.4.2
http://matplotlib.org/1.4.2/mpl_toolkits/axes_grid/users/overview#axisartist-with-parasiteaxes
Thank you, in advance :)
Matplotlib version
- Operating System: Ubuntu 16.04.3 LTS
- Matplotlib Version: 2.0.2
- Python Version: 2.7.12

Activity
afvincent commentedon Aug 30, 2017
@thehubbard Thank you for the detailed report!
I can confirm that this issue still occurs on master branch too.
tacaswell commentedon Aug 30, 2017
I have a vague memory of a related bug with axes_grid.
Somehow both the
Axesbase class + the axes_grid Axes sub-class are both trying to draw the ticks and labels.kmuehlbauer commentedon Oct 4, 2018
Just to note because I stumbled over it. This is resolved by: #11688.
ImportanceOfBeingErnest commentedon Oct 4, 2018
#11688 fixes this, but it hasn't been backported to the 2.2 branch. Is this desired?
kmuehlbauer commentedon Oct 4, 2018
@ImportanceOfBeingErnest I have no idea how much effort is needed to backport to 2.2 branch. For those who depend on 2.2 branch (eg. using py27) backporting seems the only solution.