Skip to content

constrained_layout fails with hidden axis... #14918

Closed
@jklymak

Description

@jklymak

Bug report

import numpy as np
import matplotlib.pyplot as plt

fig5, axs = plt.subplots(2, 2, constrained_layout=True)

axs[0,1].set_visible(False)

plt.show()

will yield an error:

Traceback (most recent call last):
  File "/Users/jklymak/matplotlib/lib/matplotlib/backends/backend_qt5.py", line 488, in _draw_idle
    self.draw()
  File "/Users/jklymak/matplotlib/lib/matplotlib/backends/backend_agg.py", line 396, in draw
    self.figure.draw(self.renderer)
  File "/Users/jklymak/matplotlib/lib/matplotlib/artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/Users/jklymak/matplotlib/lib/matplotlib/figure.py", line 1711, in draw
    self.execute_constrained_layout(renderer)
  File "/Users/jklymak/matplotlib/lib/matplotlib/figure.py", line 2433, in execute_constrained_layout
    do_constrained_layout(fig, renderer, h_pad, w_pad, hspace, wspace)
  File "/Users/jklymak/matplotlib/lib/matplotlib/_constrained_layout.py", line 170, in do_constrained_layout
    _make_layout_margins(ax, renderer, h_pad, w_pad)
  File "/Users/jklymak/matplotlib/lib/matplotlib/_constrained_layout.py", line 275, in _make_layout_margins
    bbox = invTransFig(tightbbox)
  File "/Users/jklymak/matplotlib/lib/matplotlib/transforms.py", line 1452, in transform_bbox
    return Bbox(self.transform(bbox.get_points()))
AttributeError: 'NoneType' object has no attribute 'get_points'

Matplotlib version

  • Matplotlib version: Master

Metadata

Metadata

Assignees

Labels

topic: geometry managerLayoutEngine, Constrained layout, Tight layout

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions