HDR*_*HDR 2 plot r rounding limit
我正试图为R情节制作整洁xlim和ylim价值观.我想:1)舍xlim[2]入到最接近的0.5的倍数,该倍数大于值向量中的最大值,2)舍xlim[1]入到最接近的0.5的倍数,该倍数小于值向量中的最小值.
例如
x <- c(1.2, 2, 3.4)
y <- c(0.7, 2, 3.7)
# The desired lim values are then
xlim <- c(1, 3.5)
ylim <- c(0.5, 4)
plot(x, y, xlim= xlim, ylim= ylim)
Run Code Online (Sandbox Code Playgroud)
提前感谢任何提示!
pretty将计算这些值,您可以range用来选择终点,
range(pretty(x))
[1] 1.0 3.5
range(pretty(y))
[1] 0.5 4.0
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
381 次 |
| 最近记录: |