MCPcopy
hub / github.com/matplotlib/matplotlib / get_cb_parent_spans

Function get_cb_parent_spans

lib/matplotlib/_constrained_layout.py:592–614  ·  view source on GitHub ↗

Figure out which subplotspecs this colorbar belongs to. Parameters ---------- cbax : `~matplotlib.axes.Axes` Axes for the colorbar.

(cbax)

Source from the content-addressed store, hash-verified

590
591
592def get_cb_parent_spans(cbax):
593 """
594 Figure out which subplotspecs this colorbar belongs to.
595
596 Parameters
597 ----------
598 cbax : `~matplotlib.axes.Axes`
599 Axes for the colorbar.
600 """
601 rowstart = np.inf
602 rowstop = -np.inf
603 colstart = np.inf
604 colstop = -np.inf
605 for parent in cbax._colorbar_info['parents']:
606 ss = parent.get_subplotspec()
607 rowstart = min(ss.rowspan.start, rowstart)
608 rowstop = max(ss.rowspan.stop, rowstop)
609 colstart = min(ss.colspan.start, colstart)
610 colstop = max(ss.colspan.stop, colstop)
611
612 rowspan = range(rowstart, rowstop)
613 colspan = range(colstart, colstop)
614 return rowspan, colspan
615
616
617def get_pos_and_bbox(ax, renderer):

Callers 3

make_layout_marginsFunction · 0.85
reposition_colorbarFunction · 0.85
colorbar_get_padFunction · 0.85

Calls 1

get_subplotspecMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…