本文整理汇总了Python中matplotlib.colorbar.make_axes_gridspec方法的典型用法代码示例。如果您正苦于以下问题:Python colorbar.make_axes_gridspec方法的具体用法?Python colorbar.make_axes_gridspec怎么用?Python colorbar.make_axes_gridspec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.colorbar
的用法示例。
在下文中一共展示了colorbar.make_axes_gridspec方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: colorbar
# 需要导入模块: from matplotlib import colorbar [as 别名]
# 或者: from matplotlib.colorbar import make_axes_gridspec [as 别名]
def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
"""
Create a colorbar for a ScalarMappable instance, *mappable*.
Documentation for the pylab thin wrapper:
%(colorbar_doc)s
"""
if ax is None:
ax = self.gca()
# Store the value of gca so that we can set it back later on.
current_ax = self.gca()
if cax is None:
if use_gridspec and isinstance(ax, SubplotBase):
cax, kw = cbar.make_axes_gridspec(ax, **kw)
else:
cax, kw = cbar.make_axes(ax, **kw)
cax.hold(True)
cb = cbar.colorbar_factory(cax, mappable, **kw)
self.sca(current_ax)
return cb
示例2: colorbar
# 需要导入模块: from matplotlib import colorbar [as 别名]
# 或者: from matplotlib.colorbar import make_axes_gridspec [as 别名]
def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
"""
Create a colorbar for a ScalarMappable instance, *mappable*.
Documentation for the pyplot thin wrapper:
%(colorbar_doc)s
"""
if ax is None:
ax = self.gca()
# Store the value of gca so that we can set it back later on.
current_ax = self.gca()
if cax is None:
if use_gridspec and isinstance(ax, SubplotBase) \
and (not self.get_constrained_layout()):
cax, kw = cbar.make_axes_gridspec(ax, **kw)
else:
cax, kw = cbar.make_axes(ax, **kw)
# need to remove kws that cannot be passed to Colorbar
NON_COLORBAR_KEYS = ['fraction', 'pad', 'shrink', 'aspect', 'anchor',
'panchor']
cb_kw = {k: v for k, v in kw.items() if k not in NON_COLORBAR_KEYS}
cb = cbar.colorbar_factory(cax, mappable, **cb_kw)
self.sca(current_ax)
self.stale = True
return cb
示例3: colorbar
# 需要导入模块: from matplotlib import colorbar [as 别名]
# 或者: from matplotlib.colorbar import make_axes_gridspec [as 别名]
def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
"""
Create a colorbar for a ScalarMappable instance, *mappable*.
Documentation for the pylab thin wrapper:
%(colorbar_doc)s
"""
if ax is None:
ax = self.gca()
# Store the value of gca so that we can set it back later on.
current_ax = self.gca()
if cax is None:
if use_gridspec and isinstance(ax, SubplotBase) \
and (not self.get_constrained_layout()):
cax, kw = cbar.make_axes_gridspec(ax, **kw)
else:
cax, kw = cbar.make_axes(ax, **kw)
cax._hold = True
# need to remove kws that cannot be passed to Colorbar
NON_COLORBAR_KEYS = ['fraction', 'pad', 'shrink', 'aspect', 'anchor',
'panchor']
cb_kw = {k: v for k, v in kw.items() if k not in NON_COLORBAR_KEYS}
cb = cbar.colorbar_factory(cax, mappable, **cb_kw)
self.sca(current_ax)
self.stale = True
return cb