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

Removal of y-shared polar axes causes crash at draw time #19989

Copy link
Copy link
Closed
@anntzer

Description

@anntzer
Issue body actions

Bug report

Bug summary

All's in the title.

Code for reproduction

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

Actual outcome

Traceback (most recent call last):
Traceback (most recent call last):
  File ".../path/to/matplotlib/backends/backend_qt5.py", line 440, in _draw_idle
    self.draw()
  File "/home/antony/src/local/mplcairo/lib/mplcairo/base.py", line 269, in draw
    self.get_renderer(_ensure_cleared=True, _ensure_drawn=True)
  File "/home/antony/src/local/mplcairo/lib/mplcairo/base.py", line 261, in get_renderer
    return self._get_cached_or_new_renderer(
  File "/home/antony/src/local/mplcairo/lib/mplcairo/base.py", line 256, in _get_cached_or_new_renderer
    self.figure.draw(renderer)
  File ".../path/to/matplotlib/artist.py", line 74, in draw_wrapper
    result = draw(artist, renderer, *args, **kwargs)
  File ".../path/to/matplotlib/artist.py", line 51, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File ".../path/to/matplotlib/figure.py", line 2730, in draw
    mimage._draw_list_compositing_images(
  File ".../path/to/matplotlib/image.py", line 132, in _draw_list_compositing_images
    a.draw(renderer)
  File ".../path/to/matplotlib/_api/deprecation.py", line 447, in wrapper
    return func(*inner_args, **inner_kwargs)
  File ".../path/to/matplotlib/_api/deprecation.py", line 447, in wrapper
    return func(*inner_args, **inner_kwargs)
  File ".../path/to/matplotlib/projections/polar.py", line 994, in draw
    super().draw(renderer, *args, **kwargs)
  File ".../path/to/matplotlib/artist.py", line 51, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File ".../path/to/matplotlib/_api/deprecation.py", line 421, in wrapper
    return func(*inner_args, **inner_kwargs)
  File ".../path/to/matplotlib/axes/_base.py", line 3102, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File ".../path/to/matplotlib/image.py", line 132, in _draw_list_compositing_images
    a.draw(renderer)
  File ".../path/to/matplotlib/artist.py", line 51, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File ".../path/to/matplotlib/axis.py", line 1124, in draw
    ticks_to_draw = self._update_ticks()
  File ".../path/to/matplotlib/axis.py", line 1011, in _update_ticks
    major_locs = self.get_majorticklocs()
  File ".../path/to/matplotlib/axis.py", line 1243, in get_majorticklocs
    return self.major.locator()
  File ".../path/to/matplotlib/projections/polar.py", line 432, in __call__
    return [tick for tick in self.base() if tick > rorigin]
  File ".../path/to/matplotlib/projections/polar.py", line 432, in __call__
    return [tick for tick in self.base() if tick > rorigin]
  File ".../path/to/matplotlib/ticker.py", line 2265, in __call__
    return self.tick_values(vmin, vmax)
  File ".../path/to/matplotlib/ticker.py", line 2273, in tick_values
    locs = self._raw_ticks(vmin, vmax)
  File ".../path/to/matplotlib/ticker.py", line 2212, in _raw_ticks
    nbins = np.clip(self.axis.get_tick_space(),
  File ".../path/to/matplotlib/axis.py", line 2513, in get_tick_space
    length = ((ends[1][1] - ends[0][1]) / self.axes.figure.dpi) * 72
AttributeError: 'NoneType' object has no attribute 'dpi'

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:

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

Edit: I have a fix, but the test is a bit simpler if #19994 goes in first.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    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.