本文整理匯總了Python中image.FigureImage.set_array方法的典型用法代碼示例。如果您正苦於以下問題:Python FigureImage.set_array方法的具體用法?Python FigureImage.set_array怎麽用?Python FigureImage.set_array使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類image.FigureImage
的用法示例。
在下文中一共展示了FigureImage.set_array方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: figimage
# 需要導入模塊: from image import FigureImage [as 別名]
# 或者: from image.FigureImage import set_array [as 別名]
def figimage(self, X,
xo=0,
yo=0,
alpha=1.0,
norm=None,
cmap=None,
vmin=None,
vmax=None,
origin=None):
"""\
FIGIMAGE(X) # add non-resampled array to figure
FIGIMAGE(X, xo, yo) # with pixel offsets
FIGIMAGE(X, **kwargs) # control interpolation ,scaling, etc
Add a nonresampled figure to the figure from array X. xo and yo are
offsets in pixels
X must be a float array
If X is MxN, assume luminance (grayscale)
If X is MxNx3, assume RGB
If X is MxNx4, assume RGBA
The following kwargs are allowed:
* cmap is a cm colormap instance, eg cm.jet. If None, default to
the rc image.cmap valuex
* norm is a matplotlib.colors.normalize instance; default is
normalization(). This scales luminance -> 0-1
* vmin and vmax are used to scale a luminance image to 0-1. If
either is None, the min and max of the luminance values will be
used. Note if you pass a norm instance, the settings for vmin and
vmax will be ignored.
* alpha = 1.0 : the alpha blending value
* origin is either 'upper' or 'lower', which indicates where the [0,0]
index of the array is in the upper left or lower left corner of
the axes. Defaults to the rc image.origin value
This complements the axes image which will be resampled to fit the
current axes. If you want a resampled image to fill the entire
figure, you can define an Axes with size [0,1,0,1].
A image.FigureImage instance is returned.
"""
if not self._hold: self.clf()
im = FigureImage(self, cmap, norm, xo, yo, origin)
im.set_array(X)
im.set_alpha(alpha)
if norm is None:
im.set_clim(vmin, vmax)
self.images.append(im )
return im