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 bc9a3e7

Browse filesBrowse files
committed
fix figure.colorbar() with axes keywords
1 parent 2132073 commit bc9a3e7
Copy full SHA for bc9a3e7

File tree

Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed

‎lib/matplotlib/figure.py

Copy file name to clipboardExpand all lines: lib/matplotlib/figure.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,12 @@ def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
18911891
else:
18921892
cax, kw = cbar.make_axes(ax, **kw)
18931893
cax._hold = True
1894-
cb = cbar.colorbar_factory(cax, mappable, **kw)
1894+
1895+
# need to remove kws that cannot be passed to Colorbar
1896+
NON_COLORBAR_KEYS = ['fraction', 'pad', 'shrink', 'aspect', 'anchor',
1897+
'panchor']
1898+
cb_kw = {k: v for k, v in kw.items() if k not in NON_COLORBAR_KEYS}
1899+
cb = cbar.colorbar_factory(cax, mappable, **cb_kw)
18951900

18961901
self.sca(current_ax)
18971902
self.stale = True

0 commit comments

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