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

Commit 3a58953

Browse filesBrowse files
jklymaktacaswell
authored andcommitted
MNT: colorbar accept numpy array input (#8739)
Accept a wider range of iterables for `ax`.
1 parent b6eb043 commit 3a58953
Copy full SHA for 3a58953

File tree

Expand file treeCollapse file tree

1 file changed

+4
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-3
lines changed

‎lib/matplotlib/colorbar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/colorbar.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,9 +1117,10 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15,
11171117
parent_anchor = kw.pop('panchor', loc_settings['panchor'])
11181118
pad = kw.pop('pad', loc_settings['pad'])
11191119

1120-
# turn parents into a list if it is not already
1121-
if not isinstance(parents, (list, tuple)):
1122-
parents = [parents]
1120+
# turn parents into a list if it is not already. We do this w/ np
1121+
# because `plt.subplots` can return an ndarray and is natural to
1122+
# pass to `colorbar`.
1123+
parents = np.atleast_1d(parents).ravel()
11231124

11241125
fig = parents[0].get_figure()
11251126
if not all(fig is ax.get_figure() for ax in parents):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.