pretty(base)
pretty()所属R语言包:base
Pretty Breakpoints
漂亮的断点
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Compute a sequence of about n+1 equally spaced "round" values which cover the range of the values in x. The values are chosen so that they are 1, 2 or 5 times a power of 10.
计算约序列n+1等距离圆的值,其中包括在x值的范围。值的选择,使他们的10次方是1,2或5倍。
用法----------Usage----------
pretty(x, ...)
## Default S3 method:[默认方法]
pretty(x, n = 5, min.n = n %/% 3, shrink.sml = 0.75,
high.u.bias = 1.5, u5.bias = .5 + 1.5*high.u.bias,
eps.correct = 0, ...)
参数----------Arguments----------
参数:x
an object coercible to numeric by as.numeric.
对象as.numeric强制转换到数字。
参数:n
integer giving the desired number of intervals. Non-integer values are rounded down.
整数,所需的时间间隔数。非整数值四舍五入。
参数:min.n
nonnegative integer giving the minimal number of intervals. If min.n == 0, pretty(.) may return a single value.
非负整数,最小间隔的数目。如果min.n == 0,pretty(.)可能返回一个单一的价值。
参数:shrink.sml
positive numeric by a which a default scale is shrunk in the case when range(x) is very small (usually 0).
积极的数值由默认的规模缩水的情况下,当range(x)是非常小的(通常为0)。
参数:high.u.bias
non-negative numeric, typically > 1. The interval unit is determined as {1,2,5,10} times b, a power of 10. Larger high.u.bias values favor larger units.
非负数值,通常> 1。间隔单位被确定为{1,2,5,10}倍b,功率为10。 high.u.bias值有利于较大的单位。
参数:u5.bias
non-negative numeric multiplier favoring factor 5 over 2. Default and "optimal": u5.bias = .5 + 1.5*high.u.bias.
有利于非负数值乘数超过2倍5。默认和“最佳”:u5.bias = .5 + 1.5*high.u.bias。
参数:eps.correct
integer code, one of {0,1,2}. If non-0, an epsilon correction is made at the boundaries such that the result boundaries will be outside range(x); in the small case, the correction is only done if eps.correct >=2.
整数代码,{0,1,2}之一。如果非0,小量校正等的界限,结果边界以外range(x);在小的情况下,只是做了改正,如果eps.correct >=2。
参数:...
further arguments for methods.
方法的进一步论据。
Details
详情----------Details----------
pretty ignores non-finite values in x.
pretty忽略x非有限值。
Let d <- max(x) - min(x) ≥ 0. If d is not (very close) to 0, we let c <- d/n, otherwise more or less c <- max(abs(range(x)))*shrink.sml / min.n. Then, the 10 base b is 10^(floor(log10(c))) such that b ≤ c < 10b.
我们d <- max(x) - min(x)的≥ 0。如果d是不是非常接近0,我们让c <- d/n,否则或多或少c <- max(abs(range(x)))*shrink.sml / min.n。然后,10个基地b是10^(floor(log10(c)))等b ≤ c < 10b。
Now determine the basic unit u as one of {1,2,5,10} b, depending on c/b in [1,10 and the two "bias" coefficients, h =high.u.bias and f =u5.bias.
现在确定的基本单位u为一体的{1,2,5,10} b,取决于c/b in [1,10和两个偏见系数,h =“high.u.bias和f = “u5.bias。
.........
.........
参考文献----------References----------
The New S Language. Wadsworth & Brooks/Cole.
参见----------See Also----------
axTicks for the computation of pretty axis tick locations in plots, particularly on the log scale.
axTicks漂亮轴刻度线的图的位置,特别是对数刻度,计算的。
举例----------Examples----------
pretty(1:15) # 0 2 4 6 8 10 12 14 16[0 2 4 6 8 10 12 13 14 15 16]
pretty(1:15, h=2)# 0 5 10 15[0 5 10 15]
pretty(1:15, n=4)# 0 5 10 15[0 5 10 15]
pretty(1:15 * 2) # 0 5 10 15 20 25 30[0 5 10 15 20 25 30]
pretty(1:20) # 0 5 10 15 20[0 5 10 15 20]
pretty(1:20, n=2) # 0 10 20[0 10 20]
pretty(1:20, n=10)# 0 2 4 ... 20[0 2 4 ... 20]
for(k in 5:11) {
cat("k=",k,": "); print(diff(range(pretty(100 + c(0, pi*10^-k)))))}
##-- more bizarre, when min(x) == max(x):[ - 更奇怪,时,分(X)==最大(X):]
pretty(pi)
add.names <- function(v) { names(v) <- paste(v); v}
utils::str(lapply(add.names(-10:20), pretty))
utils::str(lapply(add.names(0:20), pretty, min.n = 0))
sapply( add.names(0:20), pretty, min.n = 4)
pretty(1.234e100)
pretty(1001.1001)
pretty(1001.1001, shrink = .2)
for(k in -7:3)
cat("shrink=", formatC(2^k, width=9),":",
formatC(pretty(1001.1001, shrink.sml = 2^k), width=6),"\n")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|