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

Function get_subplotspec_list

lib/matplotlib/_tight_layout.py:160–191  ·  view source on GitHub ↗

Return a list of subplotspec from the given list of Axes. For an instance of Axes that does not support subplotspec, None is inserted in the list. If grid_spec is given, None is inserted for those not from the given grid_spec.

(axes_list, grid_spec=None)

Source from the content-addressed store, hash-verified

158
159
160def get_subplotspec_list(axes_list, grid_spec=None):
161 """
162 Return a list of subplotspec from the given list of Axes.
163
164 For an instance of Axes that does not support subplotspec, None is inserted
165 in the list.
166
167 If grid_spec is given, None is inserted for those not from the given
168 grid_spec.
169 """
170 subplotspec_list = []
171 for ax in axes_list:
172 axes_or_locator = ax.get_axes_locator()
173 if axes_or_locator is None:
174 axes_or_locator = ax
175
176 if hasattr(axes_or_locator, "get_subplotspec"):
177 subplotspec = axes_or_locator.get_subplotspec()
178 if subplotspec is not None:
179 subplotspec = subplotspec.get_topmost_subplotspec()
180 gs = subplotspec.get_gridspec()
181 if grid_spec is not None:
182 if gs != grid_spec:
183 subplotspec = None
184 elif gs.locally_modified_subplot_params():
185 subplotspec = None
186 else:
187 subplotspec = None
188
189 subplotspec_list.append(subplotspec)
190
191 return subplotspec_list
192
193
194def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer,

Callers 1

executeMethod · 0.90

Calls 5

get_axes_locatorMethod · 0.45
get_subplotspecMethod · 0.45
get_gridspecMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…