MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / check_no_collapsed_axes

Function check_no_collapsed_axes

lib/matplotlib/_constrained_layout.py:248–265  ·  view source on GitHub ↗

Check that no Axes have collapsed to zero size.

(layoutgrids, fig)

Source from the content-addressed store, hash-verified

246
247
248def check_no_collapsed_axes(layoutgrids, fig):
249 """
250 Check that no Axes have collapsed to zero size.
251 """
252 for sfig in fig.subfigs:
253 ok = check_no_collapsed_axes(layoutgrids, sfig)
254 if not ok:
255 return False
256 for ax in fig.axes:
257 gs = ax.get_gridspec()
258 if gs in layoutgrids: # also implies gs is not None.
259 lg = layoutgrids[gs]
260 for i in range(gs.nrows):
261 for j in range(gs.ncols):
262 bb = lg.get_inner_bbox(i, j)
263 if bb.width <= 0 or bb.height <= 0:
264 return False
265 return True
266
267
268def compress_fixed_aspect(layoutgrids, fig):

Callers 1

do_constrained_layoutFunction · 0.85

Calls 2

get_inner_bboxMethod · 0.80
get_gridspecMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…