Skip to content

Removal of x-shared polar axes causes crash #19988

Closed
@anntzer

Description

@anntzer

Bug report

Bug summary

All's in the title.

(Note that x-sharing (which really means theta-sharing) polar axes makes sense because one can use set_thetalims to draw just a wedge.)

Code for reproduction

from pylab import *
ax1, ax2 = gcf().subplots(2, sharex=True, subplot_kw={"projection": "polar"}); ax2.remove()

Actual outcome

Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File ".../path/to/matplotlib/artist.py", line 162, in remove
    self._remove_method(self)
  File ".../path/to/matplotlib/figure.py", line 967, in delaxes
    _reset_locators_and_formatters(last_ax.xaxis)
  File ".../path/to/matplotlib/figure.py", line 930, in _reset_locators_and_formatters
    isDefault = majloc.axis.isDefault_majloc
AttributeError: '_AxisWrapper' object has no attribute 'isDefault_majloc'

Expected outcome

Normal axes removal.

Matplotlib version

  • Operating system: linux
  • Matplotlib version (import matplotlib; print(matplotlib.__version__)): head
  • Matplotlib backend (print(matplotlib.get_backend())): mplcairo
  • Python version: 39
  • Jupyter version (if applicable):
  • Other libraries:

#13482 happens to fix this, because it moves handling of isDefault_* to the tickers themselves (where they logically belong), rather than having them on the axis.

(Note that this is a separate issue from #19989 as the root cause seems very different.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions