Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6014058

Browse files
authored
Merge pull request #20414 from jklymak/enh-colorbar_info
ENH: add colorbar info to gridspec cbar
2 parents 6939574 + 2288f3a commit 6014058

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/matplotlib/colorbar.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,9 @@ def __init__(self, parent, userax=True):
274274
self.outer_ax.set_yticks = self.inner_ax.set_yticks
275275
for attr in ["get_position", "set_position", "set_aspect"]:
276276
setattr(self, attr, getattr(self.outer_ax, attr))
277+
self._colorbar_info = None # used for mpl-created axes
277278
if userax:
279+
self._colorbar_info = 'user'
278280
# point the parent's methods all at this axes...
279281
parent.__dict__ = self.__dict__
280282

@@ -1487,6 +1489,15 @@ def make_axes_gridspec(parent, *, location=None, orientation=None,
14871489
fig = parent.get_figure()
14881490
cax = fig.add_subplot(ss_cb, label="<colorbar>")
14891491
cax.set_aspect(aspect, anchor=loc_settings["anchor"], adjustable='box')
1492+
cax._colorbar_info = dict(
1493+
location=location,
1494+
parents=[parent],
1495+
shrink=shrink,
1496+
anchor=anchor,
1497+
panchor=panchor,
1498+
fraction=fraction,
1499+
aspect=aspect,
1500+
pad=pad)
14901501
return cax, kw
14911502

14921503

0 commit comments

Comments
 (0)