plot.im(spatstat)
plot.im()所属R语言包:spatstat
Plot a Pixel Image
绘制像素图像
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Plot a pixel image.
绘制一个像素的图像。
用法----------Usage----------
## S3 method for class 'im'
plot(x, ..., col=NULL, valuesAreColours=NULL,
ribbon=TRUE,
ribside=c("right", "left", "bottom", "top"),
ribsep=0.15, ribwid=0.05, ribn=1024,
ribscale=1, ribargs=list())
参数----------Arguments----------
参数:x
The pixel image to be plotted. An object of class "im" (see im.object).
要绘制的像素的图像。类的一个对象"im"(见im.object)。
参数:...
Extra arguments passed to image.default to control the plot. See Details.
额外的参数传递给image.default控制的图。查看详细信息。
参数:col
Colours for displaying the pixel values. Either a character vector of colour values, or an object of class colourmap.
用于显示的像素值的颜色。一个字符向量的颜色值,或的对象类colourmap。
参数:valuesAreColours
Logical value. If TRUE, the pixel values of x are to be interpreted as colour values.
逻辑值。如果TRUE,的像素值的x的是被解释为颜色值。
参数:ribbon
Logical flag indicating whether to display a ribbon showing the colour map.
逻辑标志,指示是否显示带显示彩色图。
参数:ribside
Character string indicating where to display the ribbon relative to the main image.
字符串表示相对于主图像显示功能区。
参数:ribsep
Factor controlling the space between the ribbon and the image.
因子控制色带和图像之间的空间。
参数:ribwid
Factor controlling the width of the ribbon.
控制因素色带宽度。
参数:ribn
Number of different values to display in the ribbon.
不同的值显示在功能区中。
参数:ribscale
Rescaling factor for tick marks. The values on the numerical scale printed beside the ribbon will be multiplied by this rescaling factor.
标度因数刻度线。旁边打印色带上的数值尺度的值将被乘以这个比例改变因子。
参数:ribargs
List of additional arguments passed to image.default and axis to control the display of the ribbon and its scale axis. These may override the ... arguments.
通过额外的参数列表image.default和axis控制显示的功能区,其规模轴。这可能会覆盖...参数。
Details
详细信息----------Details----------
This is the plot method for the class "im". [It is also the image method for "im".]
这是plot方法的类"im"。这也是image方法"im"。]
The pixel image x is displayed on the current plot device, using equal scales on the x and y axes.
像素的图像x上显示当前的打印设备,使用x和y轴平等的尺度上。
If ribbon=TRUE, a legend will be plotted. The legend consists of a colour ribbon and an axis with tick-marks, showing the correspondence between the pixel values and the colour map.
如果ribbon=TRUE,将绘制一个传奇。传说由彩色色带和一个轴与刻度标记,示出的像素值之间的对应关系和颜色映射。
By default, the ribbon is placed at the right of the main image. This can be changed using the argument ribside.
默认情况下,色带放置在主图像的右侧。使用参数ribside,这是可以改变的。
Arguments ribsep, ribwid, ribn control the appearance of the ribbon. The width of the ribbon is ribwid times the size of the pixel image, where "size" means the larger of the width and the height. The distance separating the ribbon and the image is ribsep times the size of the pixel image. The ribbon contains ribn different numerical values, evenly spaced between the minimum and maximum pixel values in the image x, rendered according to the chosen colour map.
参数ribsep, ribwid, ribn控制出现的色带。色带的宽度是ribwid倍大小的像素的图像,其中的“大小”是指的宽度和高度的较大的。色带和图像的间隔距离是ribsep倍的像素图像的大小。色带包含ribn不同的数值,在图像中的最小和最大像素值之间均匀地间隔开x,根据所选择的颜色的图呈现。
Arguments ribscale, ribargs control the annotation of the colour ribbon. To plot the colour ribbon without the axis and tick-marks, use ribargs=list(axes=FALSE).
参数ribscale, ribargs控制注释的颜色带。要绘制彩色色带无轴和刻度标志,可以使用ribargs=list(axes=FALSE)。
Normally the pixel values are displayed using the colours given in the argument col. This may be either an explicit colour map (an object of class "colourmap", created by the function colourmap) or a character vector or integer vector that specifies a set of colours.
通常情况下,像素值被显示使用参数col中给定的颜色。这可能是一个明确的颜色映射(类的一个对象"colourmap",由函数创建colourmap)或字符向量或整数向量,它指定一组颜色。
If col is an explicit colour map (an object of class "colourmap") then the same colour always represents the same numeric value. For example this ensures that when we plot different images, the colour maps are consistent.
col如果是一个明确的颜色映射(类的一个对象"colourmap")相同的颜色始终代表相同的数值。例如,当我们绘制不同的图像,彩色图是一致的。
If col is a character vector or integer vector that specifies colours, then the colour mapping will be stretched to match the range of pixel values in the image x. In this case, the mapping of pixel values to colours is determined as follows.
如果col是一个字符的矢量或整数向量指定的颜色,然后将被拉伸的颜色映射匹配的范围中的像素值的图像x。在这种情况下,映射到颜色的像素值被确定为如下。
logical-valued images: the values FALSE and TRUE are mapped to the colours col[1] and col[2] respectively. The vector col should have length 2.
逻辑值图像的值FALSE和TRUE的颜色col[1]和col[2]分别被映射到。向量col应该有长度2。
factor-valued images: the factor levels levels(x) are mapped to the entries of col in order. The vector col should have the same length as levels(x).
因子值图像:因子水平levels(x)映射的条目col的。向量col应该作为levels(x)具有相同的长度。
By default, the range of pixel values in x is divided into n = length(col) equal subintervals, which are mapped to the colours in col. (If col was not specified, it defaults to a vector of 255 colours.)
默认情况下,该范围内的像素值x分为n = length(col)相等的子区间,其分别对应的颜色在col的。 (如果col未指定,则默认为一个向量的255种颜色)。
Alternatively if the argument zlim is given, it should be a vector of length 2 specifying an interval of real numbers. This interval will be used instead of the range of pixel values. The interval from zlim[1] to zlim[2] will be mapped to the colours in col. This facility enables the user to plot several images using a consistent colour map.
或者,如果变量zlim给出,它应该是一个向量,长度为2指定的时间间隔的实数。此时间间隔将被代替使用的范围的像素值。从zlim[1]到zlim[2]将被映射的颜色col的时间间隔。这个功能可以让用户使用一致的彩色图绘制图像。
Alternatively if the argument breaks is given, then this specifies the endpoints of the subintervals that are mapped to each colour. This is incompatible with zlim.
另外,如果参数breaks,然后指定端点映射到每种颜色的子区间。这不与zlim。
The arguments col and zlim or breaks are passed to the function image.default. For examples of the use of these arguments, see image.default.
的参数col和zlim或breaks被传递给函数image.default。有关使用这些参数的示例,请参阅image.default。
Other graphical parameters controlling the display of both the pixel image and the ribbon can be passed through the ... arguments to the function image.default. A parameter is handled only if it is one of the following:
其他的图形化的参数,可以通过控制显示的两个像素的图像和色带...参数的函数image.default。一个参数的处理,仅当它是下列之一:
a formal argument of image.default that is operative when add=TRUE.
一个正式的参数的image.default会是手术时add=TRUE。
one of the parameters "main", "asp", "sub", "axes", "ann", "cex", "font", "cex.axis", "cex.lab", "cex.main", "cex.sub", "col.axis", "col.lab", "col.main", "col.sub", "font.axis", "font.lab", "font.main", "font.sub" described in par.
的参数之一"main", "asp", "sub", "axes", "ann", "cex", "font", "cex.axis", "cex.lab", "cex.main", "cex.sub", "col.axis", "col.lab", "col.main", "col.sub", "font.axis", "font.lab", "font.main", "font.sub"在par描述。
the argument box, a logical value specifying whether a box should be drawn.
的说法box,一箱一逻辑值,指明是否应绘制。
By default, images are plotted using image rasters rather than polygons, by setting useRaster=TRUE in image.default.
默认情况下,使用图像栅格,而不是多边形绘制的图像,通过设置useRaster=TRUE中image.default。
Alternatively, the pixel values could be directly interpretable as colour values in R. That is, the pixel values could be character strings that represent colours, or values of a factor whose levels are character strings representing colours.
可选地,所述像素值可以是直接解释为在R中,即,所述像素值可以是字符串,表示颜色,或值的一个因素,其水平是字符串代表颜色的颜色值。
If valuesAreColours=TRUE, then the pixel values will be interpreted as colour values and displayed using these colours.
如果valuesAreColours=TRUE,那么象素值将被解释为颜色值,并使用这些颜色显示。
If valuesAreColours=FALSE, then the pixel values will not be interpreted as colour values, even if they could be.
如果valuesAreColours=FALSE,那么像素值将不会被解释为颜色值,即使它们可能是。
If valuesAreColours=NULL, the algorithm will guess what it should do. If the argument col is given, the pixel values will not be interpreted as colour values. Otherwise, if all the pixel values are strings that represent colours, then they will be interpreted and displayed as colours.
如果valuesAreColours=NULL,该算法将猜测它应该做的。如果参数col给出的像素值将不会被解释为颜色值。否则,如果所有的像素值是表示颜色的字符串,那么它们将被解释并显示为颜色。
If pixel values are interpreted as colours, the arguments col and ribbon will be ignored, and a ribbon will not be plotted.
如果被解释为颜色的像素值,参数col和ribbon会被忽略,而不会被绘制色带。
值----------Value----------
The colour map used. An object of class "colourmap".
所使用的彩色图。对象的类"colourmap"。
图像渲染的错误和问题----------Image Rendering Errors and Problems----------
The help for image.default explains that errors may occur, or images may be rendered incorrectly, on some devices, depending on the availability of colours and other device-specific constraints.
的帮助image.default解释说,可能会发生错误,或者图像可以呈现不正确地,在一些设备中,取决于颜色和其他的移动设备的特定约束的可用性。
An error may occur on some graphics devices if the image is very large. If this happens, try setting useRaster=FALSE in the call to plot.im.
一些图形设备上,如果图像是非常大的,可能会出现错误。如果发生这种情况,请尝试将useRaster=FALSE调用plot.im。
The error message useRaster=TRUE can only be used with a regular grid means that the x and y coordinates of the pixels in the image are not perfectly equally spaced, due to numerical rounding. This occurs with some images created by earlier versions of spatstat. To repair the coordinates in an image X, type X <- as.im(X).
该错误消息useRaster=TRUE can only be used with a regular grid也就是说,x和y在图像中的像素的坐标是不完全相等地隔开,由于数值的舍入。这种情况发生在一些早期版本的spatstat创建的图像。要修复图像中的坐标X,X <- as.im(X)。
(作者)----------Author(s)----------
Adrian Baddeley
<a href="mailto:Adrian.Baddeley@csiro.au">Adrian.Baddeley@csiro.au</a>
<a href="http://www.maths.uwa.edu.au/~adrian/">http://www.maths.uwa.edu.au/~adrian/</a>
and Rolf Turner
<a href="mailto:r.turner@auckland.ac.nz">r.turner@auckland.ac.nz</a>
参见----------See Also----------
im.object, colourmap, contour.im, persp.im, image.default, spatstat.options
im.object,colourmap,contour.im,persp.im,image.default,spatstat.options
实例----------Examples----------
# an image[图像]
Z <- setcov(owin())
plot(Z)
plot(Z, ribside="bottom")
# stretchable colour map[拉伸彩色图]
plot(Z, col=terrain.colors(128), axes=FALSE)
# fixed colour map[固定的彩色图]
tc <- colourmap(rainbow(128), breaks=seq(-1,2,length=129))
plot(Z, col=tc)
# tweaking the plot[调整的图]
plot(Z, main="La vie en bleu", col.main="blue", cex.main=1.5,
box=FALSE,
ribargs=list(col.axis="blue", col.ticks="blue", cex.axis=0.75))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|