找回密码
 注册
查看: 4872|回复: 0

R语言:image()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 22:01:13 | 显示全部楼层 |阅读模式
image(graphics)
image()所属R语言包:graphics

                                        Display a Color Image
                                         显示彩色图像

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Creates a grid of colored or gray-scale rectangles with colors corresponding to the values in z.  This can be used to display three-dimensional or spatial data aka images. This is a generic function.
彩色或灰度的矩形网格创建的颜色对应z值。这可以用来显示三维空间数据又名图像。这是一个通用的功能。

The functions heat.colors, terrain.colors and topo.colors create heat-spectrum (red to white) and topographical color schemes suitable for displaying ordered data, with n giving the number of colors desired.
的功能heat.colors,terrain.colors和topo.colors创建热谱(红色,白色)和地形的配色方案适合有序的数据显示,与n所需的颜色数。


用法----------Usage----------


image(x, ...)

## Default S3 method:[默认方法]
image(x, y, z, zlim, xlim, ylim, col = heat.colors(12),
      add = FALSE, xaxs = "i", yaxs = "i", xlab, ylab,
      breaks, oldstyle = FALSE, useRaster, ...)



参数----------Arguments----------

参数:x,y
locations of grid lines at which the values in z are measured.  These must be finite, non-missing and in (strictly) ascending order.  By default, equally spaced values from 0 to 1 are used.  If x is a list, its components x$x and x$y are used for x and y, respectively. If the list has component z this is used for z.
在网格线的位置中的值z测量。这些都必须是有限的,非缺失(严格)升序。默认情况下,使用等距值从0到1。如果x是list,其成分x$x和x$y是用于x和y,分别。如果列表组件z用于z。


参数:z
a matrix containing the values to be plotted (NAs are allowed).  Note that x can be used instead of z for convenience.
矩阵包含值绘制(NA的允许)。注意x可以用来代替z为了方便。


参数:zlim
the minimum and maximum z values for which colors should be plotted, defaulting to the range of the finite values of z. Each of the given colors will be used to color an equispaced interval of this range. The midpoints of the intervals cover the range, so that values just outside the range will be plotted.
最低和最高的z值的颜色应策划,拖欠z有限值范围。每一个给定的颜色将用于颜色此范围内均布间隔。间隔的中点覆盖范围,使范围以外的值将被绘制。


参数:xlim, ylim
ranges for the plotted x and y values, defaulting to the ranges of x and y.
为范围,绘制x和y值,默认为x和y的范围。


参数:col
a list of colors such as that generated by rainbow, heat.colors, topo.colors, terrain.colors or similar functions.
的颜色,如rainbow,heat.colors,topo.colors,terrain.colors或类似职能的产生。


参数:add
logical; if TRUE, add to current plot (and disregard the following four arguments).  This is rarely useful because image "paints" over existing graphics.
逻辑,如果TRUE,目前积(忽略以下四个参数)。这是很少有用的,因为image油漆超过现有的图形。


参数:xaxs, yaxs
style of x and y axis.  The default "i" is appropriate for images.  See par.
X和Y轴的风格。默认的"i"是适当的图像。看到par。


参数:xlab, ylab
each a character string giving the labels for the x and y axis.  Default to the "call names" of x or y, or to "" if these were unspecified.
每一个字符串给X和Y轴的标签。默认为“呼叫名称x或y,或""如果这些都是不确定的。


参数:breaks
a set of breakpoints for the colours: must give one more breakpoint than colour.
一种颜色的断点:必须给一个比色断点。


参数:oldstyle
logical. If true the midpoints of the colour intervals are equally spaced, and zlim[1] and zlim[2] were taken to be midpoints.  The default is to have colour intervals of equal lengths between the limits.
逻辑。如果为true的颜色区间的中点等距离,zlim[1]和zlim[2]是中点。默认是有颜色间隔相等的长度之间的界限。


参数:useRaster
logical; if TRUE a bitmap raster is used to plot the image instead of polygons. The grid must be regular in that case, otherwise an error is raised.   For the behaviour when this is not specified, see "Details".
逻辑;如果TRUE用于绘制位图的栅格图像,而不是多边形。电网必须定期在这种情况下,否则会引发错误。对于未指定的行为,看到“详细资料”。


参数:...
graphical parameters for plot may also be passed as arguments to this function, as can the plot aspect ratio asp and axes (see plot.window).
图形参数plot也可能通过这个函数的参数,可以作为图宽高比asp和axes(plot.window)。


Details

详情----------Details----------

The length of x should be equal to the nrow(z)+1 or nrow(z).  In the first case x specifies the boundaries between the cells: in the second case x specifies the midpoints of the cells.  Similar reasoning applies to y.  It probably only makes sense to specify the midpoints of an equally-spaced grid.  If you specify just one row or column and a length-one x or y, the whole user area in the corresponding direction is filled. For logarithmic x or y axes the boundaries between  cells must be specified.
x长度应该是等于nrow(z)+1或nrow(z)。 x在第一种情况下指定单元之间的界限:在第二种情况下x指定单元的中点。类似的道理适用于y。可能只在有意义的间距相等的网格指定的中点。如果你只是指定一行或一列和长度一x或y充满整个用户区,在相应的方向。对数x或y单元之间的界限,必须指定轴。

Rectangles corresponding to missing values are not plotted (and so are transparent and (unless add=TRUE) the default background painted in par("bg") will show though and if that is transparent, the canvas colour will be seen).
矩形相应的遗漏值不绘制(所以是透明的,(除非add=TRUE)par("bg")画的默认背景会显示但如果是透明的,将被视为画布颜色)。

If breaks is specified then zlim is unused and the algorithm used follows cut, so intervals are closed on the right and open on the left except for the lowest interval.
如果breaks然后指定zlim是未使用的和所使用的算法如下cut,所以间隔的权利和左侧打开除了最低间隔封闭。

Notice that image interprets the z matrix as a table of f(x[i], y[j]) values, so that the x axis corresponds to row number and the y axis to column number, with column 1 at the bottom, i.e. a 90 degree counter-clockwise rotation of the conventional printed layout of a matrix.
请注意image解释zf(x[i], y[j])值作为表的矩阵,使X轴对应行数和Y轴的底部1列,列数,即传统印刷的矩阵布局逆时针旋转90度。

Images for large z on a regular grid are rendered more efficiently with useRaster = TRUE and can prevent rare anti-aliasing artifacts, but may not be supported by all graphics devices.  Some devices (such as postscript and X11(type = "Xlib")) which do not support semi-transparent colours may emit missing values as white rather than transparent, and there may be limitations on the size of a raster image. Problems with the rendering of raster images have been reported using windows() devices under Remote Desktop.
图像的大z定期电网提供更有效的useRaster = TRUE,并能预防罕见的反走样的文物,但可能不被所有的图形设备支持。一些设备(如postscript和X11(type = "Xlib"))不支持半透明的颜色可能会发出遗漏值,而不是白色透明,有可能是光栅图像的大小的限制。已报告的问题与光栅图像的渲染下使用远程桌面windows()设备。

The graphics files in PDF and PostScript can be much smaller under this option.
PDF和PostScript图形文件,可以根据本方案少得多。

If useRaster is not specified, raster images are used when the getOption("preferRaster") is true, the grid is regular and either dev.capabilities("raster") is "yes" or it is "non-missing" and there are no missing values.
如果useRaster没有被指定,使用光栅图像时getOption("preferRaster")是真实的,网格是有规律的,要么dev.capabilities("raster")是"yes"“"non-missing"有没有遗漏值。


注意----------Note----------

Originally based on a function by Thomas Lumley.
基于托马斯·拉姆利功能。


参见----------See Also----------

filled.contour or heatmap which can look nicer (but are less modular), contour; The lattice equivalent of image is levelplot.
filled.contour或heatmap可以更好看(但少模块化),contour;lattice相当于image的是levelplot。

heat.colors, topo.colors, terrain.colors, rainbow, hsv, par.
heat.colors,topo.colors,terrain.colors,rainbow,hsv,par。

dev.capabilities to see if useRaster = TRUE is supported on the current device.
dev.capabilities如果useRaster = TRUE当前设备上的支持。


举例----------Examples----------


require(grDevices) # for colours[对色彩]
x <- y <- seq(-4*pi, 4*pi, len=27)
r <- sqrt(outer(x^2, y^2, "+"))
image(z = z <- cos(r^2)*exp(-r/6), col=gray((0:32)/32))
image(z, axes = FALSE, main = "Math can be beautiful ...",
      xlab = expression(cos(r^2) * e^{-r/6}))
contour(z, add = TRUE, drawlabels = FALSE)

# Volcano data visualized as matrix. Need to transpose and flip[火山的数据可视化矩阵。需要移调和倒装]
# matrix horizontally.[矩阵水平。]
image(t(volcano)[ncol(volcano):1,])

# A prettier display of the volcano[漂亮的显示火山爆发]
x <- 10*(1:nrow(volcano))
y <- 10*(1:ncol(volcano))
image(x, y, volcano, col = terrain.colors(100), axes = FALSE)
contour(x, y, volcano, levels = seq(90, 200, by = 5),
        add = TRUE, col = "peru")
axis(1, at = seq(100, 800, by = 100))
axis(2, at = seq(100, 600, by = 100))
box()
title(main = "Maunga Whau Volcano", font.main = 4)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-23 10:33 , Processed in 0.030544 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表