from pyplot.py

# Autogenerated by boilerplate.py.  Do not edit as changes will be lost.
# 由boilerplate.py自动生成。 请勿编辑,因为更改将丢失。
@docstring.copy(Axes.imshow)
def imshow(X, cmap=None, norm=None, aspect=None, interpolation=None,alpha=None, vmin=None, vmax=None, origin=None, extent=None,shape=cbook.deprecation._deprecated_parameter, filternorm=1,filterrad=4.0, imlim=cbook.deprecation._deprecated_parameter,resample=None, url=None, *, data=None, **kwargs):__ret = gca().imshow(X, cmap=cmap, norm=norm, aspect=aspect,interpolation=interpolation, alpha=alpha, vmin=vmin,vmax=vmax, origin=origin, extent=extent, shape=shape,filternorm=filternorm, filterrad=filterrad, imlim=imlim,resample=resample, url=url, **({"data": data} if data is notNone else {}), **kwargs)sci(__ret)return __ret

from _axes.py

#### plotting z(x,y): imshow, pcolor and relatives, contour 绘制z(x,y):imshow,pcolor和相关的,轮廓@_preprocess_data()@cbook._delete_parameter("3.1", "shape")@cbook._delete_parameter("3.1", "imlim")def imshow(self, X, cmap=None, norm=None, aspect=None,interpolation=None, alpha=None, vmin=None, vmax=None,origin=None, extent=None, shape=None, filternorm=1,filterrad=4.0, imlim=None, resample=None, url=None, **kwargs):"""Display an image, i.e. data on a 2D regular raster.在2D常规栅格上显示图像,即数据。Parameters----------X : array-like or PIL imageThe image data. Supported array shapes are:阵列状或PIL图像图像数据。 支持的数组形状为:- (M, N): an image with scalar data. The data is visualizedusing a colormap.具有标量数据的图像。 数据使用颜色图可视化。- (M, N, 3): an image with RGB values (0-1 float or 0-255 int).具有RGB值(0-1浮点或0-255整数)的图像。- (M, N, 4): an image with RGBA values (0-1 float or 0-255 int),i.e. including transparency.具有RGBA值(0-1浮点或0-255整数)的图像,即包括透明度。The first two dimensions (M, N) define the rows and columns ofthe image.前两个维度(M,N)定义图像的行和列。Out-of-range RGB(A) values are clipped. 超出范围的RGB(A)值将被裁剪。cmap : str or `~matplotlib.colors.Colormap`, optionalThe Colormap instance or registered colormap name used to mapscalar data to colors. This parameter is ignored for RGB(A) data.Defaults to :rc:`image.cmap`.str或〜matplotlib.colors.Colormap`,可选用于将标量数据映射到颜色的Colormap实例或注册的颜色图名称。 对于RGB(A)数据,将忽略此参数。默认为:rc.`image.cmap`。norm : `~matplotlib.colors.Normalize`, optionalThe `Normalize` instance used to scale scalar data to the [0, 1]range before mapping to colors using *cmap*. By default, a linearscaling mapping the lowest value to 0 and the highest to 1 is used.This parameter is ignored for RGB(A) data.〜matplotlib.colors.Normalize,可选在使用* cmap *映射到颜色之前,“ Normalize”实例用于将标量数据缩放到[0,1]范围。 默认情况下,使用线性比例将最小值映射到0,将最大值映射到1。对于RGB(A)数据,将忽略此参数。aspect : {'equal', 'auto'} or float, optionalControls the aspect ratio of the axes. The aspect is of particularrelevance for images since it may distort the image, i.e. pixelwill not be square.{'equal','auto'}或float,可选控制轴的纵横比。 该方面与图像特别相关,因为它可能使图像失真,即像素将不会是正方形的。This parameter is a shortcut for explicitly calling`.Axes.set_aspect`. See there for further details.这个参数是显式调用`.Axes.set_aspect`的快捷方式。 有关更多详细信息,请参见此处。- 'equal': Ensures an aspect ratio of 1. Pixels will be square(unless pixel sizes are explicitly made non-square in datacoordinates using *extent*).确保纵横比为1。像素将为正方形(除非使用* extent *在数据坐标中将像素大小明确地设为非正方形)。- 'auto': The axes is kept fixed and the aspect is adjusted sothat the data fit in the axes. In general, this will result innon-square pixels.轴保持固定,并且调整了宽高比,以使数据适合轴。 通常,这将导致非正方形像素。If not given, use :rc:`image.aspect` (default: 'equal').如果未给出,请使用image.aspect(默认值:等于)。interpolation : str, optionalThe interpolation method used. If *None*:rc:`image.interpolation` is used, which defaults to 'nearest'.str,可选使用的插值方法。 如果使用* None *:rc:`image.interpolation`,则默认为'nearest'。Supported values are 'none', 'nearest', 'bilinear', 'bicubic','spline16', 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser','quadric', 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc','lanczos'.支持的值是“ none”,“ nearest”,“ bilinear”,“ bicubic”,“ spline16”,“ spline36”,“ hanning”,“ hamming”,“ hermite”,“ kaiser”,“ quadric”,“ catrom” ,“高斯”,“贝塞尔”,“米切尔”,“辛克”,“兰科斯”。If *interpolation* is 'none', then no interpolation is performedon the Agg, ps, pdf and svg backends. Other backends will fall backto 'nearest'. Note that most SVG renders perform interpolation atrendering and that the default interpolation method they implementmay differ.如果* interpolation *为'none',则不会在Agg,ps,pdf和svg后端上执行插值。 其他后端将回落到“最近”。 请注意,大多数SVG渲染都会在渲染时执行插值,并且它们实现的默认插值方法可能有所不同。See:doc:`/gallery/images_contours_and_fields/interpolation_methods`for an overview of the supported interpolation methods.:doc:`/ gallery / images_contours_and_fields / interpolation_methods`可以大致了解所支持的插值方法。Some interpolation methods require an additional radius parameter,which can be set by *filterrad*. Additionally, the antigrain imageresize filter is controlled by the parameter *filternorm*.某些插值方法需要附加的半径参数,可以由* filterrad *设置。 此外,防颗粒图像调整大小滤镜由参数* filternorm *控制。alpha : scalar, optionalThe alpha blending value, between 0 (transparent) and 1 (opaque).This parameter is ignored for RGBA input data.标量,可选Alpha混合值,介于0(透明)和1(不透明)之间。对于RGBA输入数据,将忽略此参数。vmin, vmax : scalar, optionalWhen using scalar data and no explicit *norm*, *vmin* and *vmax*define the data range that the colormap covers. By default,the colormap covers the complete value range of the supplieddata. *vmin*, *vmax* are ignored if the *norm* parameter is used.标量,可选当使用标量数据并且没有明确的* norm *时,* vmin *和* vmax *定义颜色图覆盖的数据范围。 默认情况下,颜色图覆盖所提供数据的完整值范围。 如果使用* norm *参数,则* vmin *,* vmax *将被忽略。origin : {'upper', 'lower'}, optionalPlace the [0,0] index of the array in the upper left or lower leftcorner of the axes. The convention 'upper' is typically used formatrices and images.If not given, :rc:`image.origin` is used, defaulting to 'upper'.可选的将数组的[0,0]索引放置在轴的左上角或左下角。 约定“ upper”通常用于矩阵和图像。 如果未指定,则使用image.origin,默认为'upper'。Note that the vertical axes points upward for 'lower'but downward for 'upper'.请注意,垂直轴指向上方表示“下方”,但指向下方表示“上方”。See the :doc:`/tutorials/intermediate/imshow_extent` tutorial forexamples and a more detailed description.doc:`/ tutorials / intermediate / imshow_extent`教程中的示例和更详细的描述。extent : scalars (left, right, bottom, top), optionalThe bounding box in data coordinates that the image will fill.The image is stretched individually along x and y to fill the box.可选的数据将要填充的数据中的边界框。图像分别沿x和y拉伸以填充框。The default extent is determined by the following conditions.Pixels have unit size in data coordinates. Their centers are oninteger coordinates, and their center coordinates range from 0 tocolumns-1 horizontally and from 0 to rows-1 vertically.默认范围由以下条件决定。像素在数据坐标中具有单位大小。 它们的中心在整数坐标上,并且其中心坐标的范围从水平0到列1,垂直从0到行1。Note that the direction of the vertical axis and thus the defaultvalues for top and bottom depend on *origin*:请注意,垂直轴的方向以及顶部和底部的默认值取决于* origin *:- For ``origin == 'upper'`` the default is``(-0.5, numcols-0.5, numrows-0.5, -0.5)``.- For ``origin == 'lower'`` the default is``(-0.5, numcols-0.5, -0.5, numrows-0.5)``.See the :doc:`/tutorials/intermediate/imshow_extent` tutorial forexamples and a more detailed description.filternorm : bool, optional, default: TrueA parameter for the antigrain image resize filter (see theantigrain documentation).  If *filternorm* is set, the filternormalizes integer values and corrects the rounding errors. Itdoesn't do anything with the source floating point values, itcorrects only integers according to the rule of 1.0 which meansthat any sum of pixel weights must be equal to 1.0.  So, thefilter function must produce a graph of the proper shape.bool,可选,默认值:True抗纹理图像调整大小过滤器的参数(请参阅抗纹理文档)。 如果设置了* filternorm *,则过滤器将对整数值进行归一化并纠正舍入误差。 它对源浮点值不做任何事情,它仅根据1.0的规则校正整数,这意味着任何像素权重之和必须等于1.0。因此,过滤器功能必须产生适当形状的图形。filterrad : float > 0, optional, default: 4.0The filter radius for filters that have a radius parameter, i.e.when interpolation is one of: 'sinc', 'lanczos' or 'blackman'.float> 0,可选,默认值:4.0具有半径参数的滤镜的滤镜半径,即当插值是“ sinc”,“ lanczos”或“ blackman”之一时。resample : bool, optionalWhen *True*, use a full resampling method.  When *False*, onlyresample when the output image is larger than the input image.布尔值,可选当为“真”时,请使用完整的重采样方法。 当* False *时,仅当输出图像大于输入图像时才重新采样。url : str, optionalSet the url of the created `.AxesImage`. See `.Artist.set_url`.str,可选设置创建的`.AxesImage`的网址。 参见`.Artist.set_url`。Returns-------image : `~matplotlib.image.AxesImage`Other Parameters----------------**kwargs : `~matplotlib.artist.Artist` propertiesThese parameters are passed on to the constructor of the`.AxesImage` artist.这些参数被传递给`.AxesImage`艺术家的构造函数。See also--------matshow : Plot a matrix or an array as an image.Notes-----Unless *extent* is used, pixel centers will be located at integercoordinates. In other words: the origin will coincide with the centerof pixel (0, 0).除非使用* extent *,否则像素中心将位于整数坐标处。 换句话说:原点将与像素(0,0)的中心重合。There are two common representations for RGB images with an alphachannel:具有alpha通道的RGB图像有两种常见表示形式:-   Straight (unassociated) alpha: R, G, and B channels represent thecolor of the pixel, disregarding its opacity.直(无关联)alpha:R,G和B通道代表像素的颜色,而忽略其不透明度。-   Premultiplied (associated) alpha: R, G, and B channels representthe color of the pixel, adjusted for its opacity by multiplication.预乘(关联)的alpha:R,G和B通道表示像素的颜色,通过乘法对其像素的不透明度进行了调整。`~matplotlib.pyplot.imshow` expects RGB images adopting the straight(unassociated) alpha representation.〜matplotlib.pyplot.imshow`期望RGB图像采用直接(未关联)的alpha表示。"""if norm is not None and not isinstance(norm, mcolors.Normalize):raise ValueError("'norm' must be an instance of 'mcolors.Normalize'")if aspect is None:aspect = rcParams['image.aspect']self.set_aspect(aspect)im = mimage.AxesImage(self, cmap, norm, interpolation, origin, extent,filternorm=filternorm, filterrad=filterrad,resample=resample, **kwargs)im.set_data(X)im.set_alpha(alpha)if im.get_clip_path() is None:# image does not already have clipping set, clip to axes patchim.set_clip_path(self.patch)if vmin is not None or vmax is not None:im.set_clim(vmin, vmax)else:im.autoscale_None()im.set_url(url)# update ax.dataLim, and, if autoscaling, set viewLim# to tightly fit the image, regardless of dataLim.im.set_extent(im.get_extent())self.add_image(im)return im

注:在pycharm上调用了imshow()函数后,图像还是没法打印,后来加了plt.show()函数后,就好了。。。

python matplotlib.pyplot.imshow() (在2D常规栅格上显示图像(数据))相关推荐

  1. python imshow cmap,Python matplotlib.pyplot.imshow()用法及代码示例

    Matplotlib是Python中的一个库,它是数字的-NumPy库的数学扩展. Pyplot是Matplotlib模块的基于状态的接口,该模块提供了MATLAB-like接口. matplotli ...

  2. Python:matplotlib pyplot库函数 savefig所支持的格式以及图片插入word保存后模糊的完美解决方法

    Python:matplotlib pyplot库函数 savefig所支持的格式以及图片插入word保存后模糊的完美解决方法 202012月更新 savefig支持的格式 图片插入word,保存后不 ...

  3. python Matplotlib.pyplot 如何绘制三维折线图, 散点图, 线框图, 表面图, 柱状图, 箭头图, 2D转3D图, 文本图, 3D拼图, 网状图, 直方图, 角面片图, 条状图?

    参考文章1: Matplotlib.pyplot 三维绘图 https://www.cnblogs.com/wuwen19940508/p/8638266.html 参考文章2: [python图像处 ...

  4. matlab中jet的例子,Python matplotlib.pyplot.jet()用法及代码示例

    Matplotlib是Python中的一个库,它是数字的-NumPy库的数学扩展. Pyplot是Matplotlib模块的基于状态的接口,该模块提供了MATLAB-like接口. matplotli ...

  5. python matplotlib.pyplot plt.ioff()函数(关闭交互模式用于阻塞程序,不让图片关闭)

    感觉ioff()函数就是个全局设置的东东,启动它,则图形绘制到最后窗口不会关闭(检测到有新的绘制就会更新窗口内容),否则因为开启了ion()交互模式,窗口绘制完就默认关闭 def ioff():&qu ...

  6. matlab怎么设clim,Python Matplotlib.pyplot.clim()用法及代码示例

    Matplotlib是Python中的一个库,它是数字的-NumPy库的数学扩展. Pyplot是Matplotlib模块的基于状态的接口,该模块提供了MATLAB-like接口.在Pyplot中可以 ...

  7. Python matplotlib pyplot中title() xlabel() ylabel()无法显示在中文(方框乱码)的解决办法

    Python matplotlib包其实是支持unicode的,但是我在实验中无法正常显示中文,比如说在pyplot.title()中输出中文,我试过以下几种方法均不奏效: pyplot.title( ...

  8. python matplotlib.pyplot.xticks() yticks() (设置x或y轴对应显示的标签)

    from matplotlib\pyplot.py def xticks(ticks=None, labels=None, **kwargs):"""Get or set ...

  9. Python matplotlib.pyplot库简要学习

    Pyplot 是 Matplotlib 的子库,提供了和 MATLAB 类似的绘图 API.Pyplot 是常用的绘图模块,能很方便让用户绘制 2D 图表.Pyplot 包含一系列绘图函数的相关函数, ...

最新文章

  1. git全局ignore
  2. 最全编程语言在线 API 文档
  3. 2020款iPhone SE最快下周发布:价格3000以内
  4. 记-ItextPDF+freemaker 生成PDF文件---导致服务宕机
  5. 计算机碎片整理的作用,经常做磁盘碎片整理的好处
  6. 手机没网了,却还能支付,这是什么原理?
  7. SQLDbx工具连接Oracle数据库
  8. java五子棋核心算法_五子棋的核心算法(转)
  9. LINUX下的makefile学习(此文是我学习过程遇到问题时找到的所有回答,感谢其它大佬的回答,各个文章我都标明了原文链接)
  10. H5页面的测试点整理
  11. 自动化运维之自动化监控
  12. 基于web的在线视频编辑的设计
  13. 每日一句—英语长难句
  14. 春招进行中,想进外企?500强资深程序员谈谈外企真实感受!
  15. 雅虎高管解读财报 当务之急是分拆资产
  16. 小学计算机程序竞赛,25届宁波市中小学计算机程序设计竞赛初赛试题
  17. jquery设置图片比例
  18. 计算机wps应用题题目,WPS Office模拟试题「附答案」
  19. 一加3t刷机后还卡_一加OnePlus 3T官方固件刷机教程_线刷|救砖教程图解
  20. Python实例20:三国演义词云分析

热门文章

  1. mysql 同步中历史记录_[Mysql]备份同库中一张表的历史记录 insert into ..select
  2. 关于电商你应该知道的!!!(深度好文)
  3. Insert Data into Sorted Table
  4. 浅析SAP EWM与WMS的差异
  5. ABAP中Conversion Routine示例
  6. PLSQL Developer使用技巧整理
  7. smartform 中currency 字段的小数点问题
  8. 发挥数据库价值,企业实现最大数据价值挖掘的路径在这里
  9. 新消费风口再“热闹”,红利依然握在伊利、康师傅们手里
  10. mysql5.7配置innodb_MySQL_5.7新特性innodb-buffer-pool-size配置