removing a shared axes via ax.remove() leads to an error.
This bisects to "Fix locator/formatter setting when removing shared Axes" #13983 (in current master, targeted for 3.2) which initially headed out to make the situation of removing a shared axes better, fixing #12853, but apparently the test doesn't capture the below simple case.
Hence marking as release critical for 3.2, in order not to release this bug.
Traceback (most recent call last):
File "d:\***\matplotlib\lib\matplotlib\backends\backend_qt5.py", line 488, in _draw_idle
self.draw()
File "d:\***\matplotlib\lib\matplotlib\backends\backend_agg.py", line 396, in draw
self.figure.draw(self.renderer)
File "d:\***\matplotlib\lib\matplotlib\artist.py", line 38, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "d:\***\matplotlib\lib\matplotlib\figure.py", line 1722, in draw
renderer, self, artists, self.suppressComposite)
File "d:\***\matplotlib\lib\matplotlib\image.py", line 136, in _draw_list_compositing_images
a.draw(renderer)
File "d:\***\matplotlib\lib\matplotlib\artist.py", line 38, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "d:\***\matplotlib\lib\matplotlib\axes\_base.py", line 2622, in draw
mimage._draw_list_compositing_images(renderer, self, artists)
File "d:\***\matplotlib\lib\matplotlib\image.py", line 136, in _draw_list_compositing_images
a.draw(renderer)
File "d:\***\matplotlib\lib\matplotlib\artist.py", line 38, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "d:\***\matplotlib\lib\matplotlib\axis.py", line 1227, in draw
ticks_to_draw = self._update_ticks()
File "d:\***\matplotlib\lib\matplotlib\axis.py", line 1103, in _update_ticks
major_locs = self.get_majorticklocs()
File "d:\***\matplotlib\lib\matplotlib\axis.py", line 1348, in get_majorticklocs
return self.major.locator()
File "d:\***\matplotlib\lib\matplotlib\ticker.py", line 2032, in __call__
return self.tick_values(vmin, vmax)
File "d:\***\matplotlib\lib\matplotlib\ticker.py", line 2040, in tick_values
locs = self._raw_ticks(vmin, vmax)
File "d:\***\matplotlib\lib\matplotlib\ticker.py", line 1979, in _raw_ticks
nbins = np.clip(self.axis.get_tick_space(),
File "d:\***\matplotlib\lib\matplotlib\axis.py", line 2193, in get_tick_space
length = ((ends[1][0] - ends[0][0]) / self.axes.figure.dpi) * 72
AttributeError: 'NoneType' object has no attribute 'dpi'
Expected outcome
A plot with the first axes removed, as would be achieved with the same code running in 3.1
Activity