Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ParasiteAxes over plotting #9051

Copy link
Copy link
Closed
Closed
Copy link
@thehubbard

Description

@thehubbard
Issue body actions

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.
over_plot

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

over_plot_142

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.