colorRamp(grDevices)
colorRamp()所属R语言包:grDevices
Color interpolation
色彩插值
译者:生物统计家园网 机器人LoveR
描述----------Description----------
These functions return functions that interpolate a set of given colors to create new color palettes (like topo.colors) and color ramps, functions that map the interval [0, 1] to colors (like grey).
这些函数返回的功能,插一组给定的颜色,创建新的调色板(如topo.colors)和彩色的坡道,函数映射的间隔[0, 1]颜色(像grey)。
用法----------Usage----------
colorRamp(colors, bias = 1, space = c("rgb", "Lab"),
interpolate = c("linear", "spline"))
colorRampPalette(colors, ...)
参数----------Arguments----------
参数:colors
Colors to interpolate
颜色插值
参数:bias
A positive number. Higher values give more widely spaced colors at the high end.
一个正数。更高的价值,在高端的更广泛的间隔颜色。
参数:space
Interpolation in RGB or CIE Lab color spaces
RGB或CIE Lab色彩空间插值
参数:interpolate
Use spline or linear interpolation.
使用样条线或直线插补。
参数:...
arguments to pass to colorRamp.
参数传递到colorRamp。
Details
详情----------Details----------
The CIE Lab color space is approximately perceptually uniform, and so gives smoother and more uniform color ramps. On the other hand, palettes that vary from one hue to another via white may have a more symmetrical appearance in RGB space.
CIE Lab色彩空间大约是感性的统一,并因此使平滑,色彩更均匀坡道。另一方面,从一个色调变化到另一个通过白色的调色板可能在RGB空间中有一个更对称的外观。
The conversion formulas in this function do not appear to be completely accurate and the color ramp may not reach the extreme values in Lab space. Future changes in the R color model may change the colors produced with space="Lab".
在此功能的转换公式,似乎不完全准确,可能达不到色的坡道Lab空间中的极端值。在R颜色模型未来的变化可能会改变与space="Lab"产生的颜色。
值----------Value----------
colorRamp returns a function that maps values between 0 and 1 to colors. colorRampPalette returns a function that takes an integer argument and returns that number of colors interpolating the given sequence (similar to heat.colors or terrain.colors.
colorRamp返回一个函数,映射值0和1之间的颜色。 colorRampPalette返回一个函数,它接受一个整数参数,并返回插值给定序列的颜色(类似heat.colors或terrain.colors。
参见----------See Also----------
Good starting points for interpolation are the "sequential" and "diverging" ColorBrewer palettes in the RColorBrewer package
良好的开端插补点是“连续”和“分流”在RColorBrewer包ColorBrewer调色板
举例----------Examples----------
require(graphics)
## Here space="rgb" gives palettes that vary only in saturation,[#这里空间=“RGB”为调色板只有在饱和度变化,]
## as intended.[#为目的。]
## With space="Lab" the steps are more uniform, but the hues[=“#与空间实验室”的步骤是比较均匀,但在色调]
## are slightly purple.[#是略带紫色。]
filled.contour(volcano,
color.palette =
colorRampPalette(c("red", "white", "blue")),
asp = 1)
filled.contour(volcano,
color.palette =
colorRampPalette(c("red", "white", "blue"),
space = "Lab"),
asp = 1)
## Interpolating a 'sequential' ColorBrewer palette[#插值“连续”ColorBrewer调色板]
YlOrBr <- c("#FFFFD4", "#FED98E", "#FE9929", "#D95F0E", "#993404")[FFFFD4“,”#FED98E“,”#FE9929“,”#D95F0E“,”#993404“)]
filled.contour(volcano,
color.palette = colorRampPalette(YlOrBr, space = "Lab"),
asp = 1)
filled.contour(volcano,
color.palette = colorRampPalette(YlOrBr, space = "Lab",
bias = 0.5),
asp = 1)
## 'jet.colors' is "as in Matlab"[#jet.colors“是”为在Matlab“]
## (and hurting the eyes by over-saturation)[#(和伤害过饱和的眼睛)]
jet.colors <-
colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",[00007F“,”蓝“,#007FFF”的,“青色”,]
"#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000"))[7FFF7F“,”黄色“,”#FF7F00“,”红“,”#7F0000“))]
filled.contour(volcano, color = jet.colors, asp = 1)
## space="Lab" helps when colors don't form a natural sequence[#空间=“实验室”帮助时,颜色不会形成一个自然顺序]
m <- outer(1:20,1:20,function(x,y) sin(sqrt(x*y)/3))
rgb.palette <- colorRampPalette(c("red", "orange", "blue"),
space = "rgb")
Lab.palette <- colorRampPalette(c("red", "orange", "blue"),
space = "Lab")
filled.contour(m, col = rgb.palette(20))
filled.contour(m, col = Lab.palette(20))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|