level.colors(lattice)
level.colors()所属R语言包:lattice
A function to compute false colors representing a numeric or categorical variable
一个函数来计算虚假的颜色代表一个数字或分类变量
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Calculates false colors from a numeric variable (including factors, using their numeric codes) given a color scheme and breakpoints.
计算从假色配色方案和断点数字变量(因素,包括使用数字代码)。
用法----------Usage----------
level.colors(x, at, col.regions, colors = TRUE, ...)
参数----------Arguments----------
参数:x
A numeric or factor variable.
一个数字或factor变量。
参数:at
A numeric variable of breakpoints defining intervals along the range of x.
一个断点沿x范围内定义的时间间隔的数值变量。
参数:col.regions
A specification of the colors to be assigned to each interval defined by at. This could be either a vector of colors, or a function that produces a vector of colors when called with a single argument giving the number of colors. See details below.
被分配到at定义每个时间间隔的颜色规范。这可能是一个向量的颜色,或产生一个颜色的向量功能,当一个单一的颜色数的参数调用。详见下文。
参数:colors
logical indicating whether colors should be computed and returned. If FALSE, only the indices representing which interval (among those defined by at) each value in x falls into is returned.
逻辑表示的颜色是否应该被计算并返回。如果FALSE,仅代表指数的时间间隔(其中定义的at)中的每个值x将返回下降。
参数:...
Extra arguments, ignored.
额外的参数,忽略。
Details
详情----------Details----------
If at has length n, then it defines n-1 intervals. Values of x outside the range of at are not assigned to an interval, and the return value is NA for such values.
如果at有长度为n,那么它定义了n-1个间隔。值x范围之外的at不分配到的时间间隔,返回值是NA这种价值观。
Colors are chosen by assigning a color to each of the n-1 intervals. If col.regions is a palette function (such as topo.colors, or the result of calling colorRampPalette), it is called with n-1 as an argument to obtain the colors. Otherwise, if there are exactly n-1 colors in col.regions, these get assigned to the intervals. If there are fewer than n-1 colors, col.regions gets recycled. If there are more, a more or less equally spaced (along the length of col.regions) subset is chosen.
选择一种颜色分配到每个n-1个间隔的颜色。如果col.regions是topo.colors调色板功能(如colorRampPalette,或调用的结果),它被称为N-1作为参数,以获得颜色。否则,如果恰好有n-1个颜色col.regions,这些被分配的时间间隔。如果有少于N-1的颜色,col.regions被回收。如果有,或多或少等距(沿col.regions长度)的子集选择。
值----------Value----------
A vector of the same length as x. Depending on the colors argument, this could be either a vector of colors (in a form usable by R), or a vector of integer indices representing which interval the values of x fall in.
为x相同长度的向量。根据colors参数,这可能是颜色矢量(使用的形式在一个由R),或代表间隔值x里钻的整数索引向量
作者(S)----------Author(s)----------
Deepayan Sarkar <a href="mailto:deepayan.sarkar@r-project.org">deepayan.sarkar@r-project.org</a>
参见----------See Also----------
levelplot, colorRampPalette.
levelplot,colorRampPalette。
举例----------Examples----------
depth.col <-
with(quakes,
level.colors(depth, at = do.breaks(range(depth), 30),
col.regions = terrain.colors))
xyplot(lat ~ long | equal.count(stations), quakes,
strip = strip.custom(var.name = "Stations"),
colours = depth.col,
panel = function(x, y, colours, subscripts, ...) {
panel.xyplot(x, y, pch = 21, col = "transparent",
fill = colours[subscripts], ...)
})
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|