本文整理汇总了Python中matplotlib.axes.Axes.imshow方法的典型用法代码示例。如果您正苦于以下问题:Python Axes.imshow方法的具体用法?Python Axes.imshow怎么用?Python Axes.imshow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.axes.Axes
的用法示例。
在下文中一共展示了Axes.imshow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: imshow
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import imshow [as 别名]
def imshow(self, *args, **kwargs):
"""
If the **mantid** projection is chosen, it can be
used the same as :py:meth:`matplotlib.axes.Axes.imshow` for arrays,
or it can be used to plot :class:`mantid.api.MatrixWorkspace`
or :class:`mantid.api.IMDHistoWorkspace`. You can have something like::
import matplotlib.pyplot as plt
from mantid import plots
...
fig, ax = plt.subplots(subplot_kw={'projection':'mantid'})
ax.imshow(workspace) #for workspaces
ax.imshow(C) #for arrays
fig.show()
For keywords related to workspaces, see :func:`plotfunctions.imshow`
"""
if helperfunctions.validate_args(*args):
logger.debug('using plotfunctions')
def _update_data(artists, workspace):
return self._redraw_colorplot(plotfunctions.imshow,
artists, workspace, **kwargs)
workspace = args[0]
return self.track_workspace_artist(workspace,
plotfunctions.imshow(self, *args, **kwargs),
_update_data)
else:
return Axes.imshow(self, *args, **kwargs)
示例2: display_image
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import imshow [as 别名]
def display_image(self):
# plot and save the image
img = self.compute_image()
# clear previous figure
self.fig.clf()
# setup plot
ax = Axes(self.fig, [0, 0, 1, 1]) # remove outer border
ax.set_axis_off() # disable axis
ax.set_xlim((self.xmin, self.xmax))
ax.set_ylim((self.ymin, self.ymax))
ax.set_xticklabels([])
ax.set_yticklabels([])
ax.imshow(img, cmap=pl.get_cmap(self.cmap), interpolation='nearest',
extent=[self.xmin, self.xmax, self.ymin, self.ymax],
origin='upper', aspect=1.0)
self.fig.add_axes(ax)
示例3: imshow
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import imshow [as 别名]
def imshow(self, *args, **kwargs):
'''
If the **mantid** projection is chosen, it can be
used the same as :py:meth:`matplotlib.axes.Axes.imshow` for arrays,
or it can be used to plot :class:`mantid.api.MatrixWorkspace`
or :class:`mantid.api.IMDHistoWorkspace`. You can have something like::
import matplotlib.pyplot as plt
from mantid import plots
...
fig, ax = plt.subplots(subplot_kw={'projection':'mantid'})
ax.imshow(workspace) #for workspaces
ax.imshow(C) #for arrays
fig.show()
For keywords related to workspaces, see :func:`mantid.plots.plotfunctions.imshow`
'''
if mantid.plots.helperfunctions.validate_args(*args):
mantid.kernel.logger.debug('using mantid.plots.plotfunctions')
return mantid.plots.plotfunctions.imshow(self, *args, **kwargs)
else:
return Axes.imshow(self, *args, **kwargs)