fdcu ylim 在绘图包中不起作用:hydroTSM - 对数 y 轴
fdcu ylim doesn't work in plot package: hydroTSM - logaritmic y-axis
我正在尝试使用 fdcu.matrix 函数使用包 hydroTSM 绘制流量持续时间曲线。不幸的是,我无法设法增加或减少 y 轴长度。我用 ylim=c(lownumber,highnumber).
试过了
当这不起作用时,我尝试将包复制粘贴到 R 中,这样我就可以 运行 它作为一个函数并对其进行调整......但是 fdcu.matrix 不幸的是没有' t 运行 没有 require(hydroTSM)。
(在 https://github.com/cran/hydroTSM/blob/master/R/fdcu.R 可用)
如何手动或自动将 ylim 调整到数据范围..?
这是我的数据矩阵的一部分:
dput(m.fdc01[1:20,1:5])
structure(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 6.45, 6.45, 6.45, 6.45, 6.372, 6.372, 6.529,
7.09, 3.8, 8.015, 8.277, 9.361, 10.41, 10.705, 9.548, 8.811,
9.176, 8.631, 8.542, 8.365, 8.189, 8.102, 7.588, 7.42, 7.254,
7.09, 7.008, 6.927, 6.847, 6.767, 6.687, 6.687, 6.687, 6.687,
6.847, 6.927, 1.008, 6.927, 7.09, 7.758, 8.277, 7.929, 7.843,
7.673, 7.588, 7.588, 7.588, 7.588, 7.588, 7.42, 7.42, 8.811,
9.927, 8.631, 8.189, 7.673, 7.42, 7.254, 7.008, 7.008, 17.397,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, 16.782, 15.82), .Dim = c(20L, 5L), .Dimnames = list(NULL,
c("DayOfYear", "1970", "1971", "1972", "1973")))
# Plot with multiple flow duration curves & legend:
require(hydroTSM)
fdcu.matrix(m.fdc01[,-1], lband=m.fdc01[,-1], uband=m.fdc01[,-1], sim=m.fdc[,-1], plot=TRUE,
main ="FDC station 1LA04:1970-1978", xlab="% Time flow equalled or exceeded",
ylab="Q, [m3/s]", ylim=c(1,50),yat=c(0.01,0.02,0.05, 0.1,0.2,0.5, 1,2,5,10,20,50,100),
bands.col = "white", col=col_matsel, lwd=mat_lwd,leg.txt="",
leg.cex=0.5,leg.pos="auto",cex.axis=1,thr.shw=FALSE)
legend("bottomleft",legendtextsel,col=col_matsel, lwd=4, y.intersp=1,bty="n",cex=1)
我觉得这是一个错误。我建议您联系开发商。当fdcu.matrix()
在算法中使用fdcu()
时,fdcu.matrix()
并没有把ylim
的信息给fdcu()
。您可以通过复制原始代码并仅删除一个术语来轻松制作 modifid fdcu.matrix()
。
准备
运行 fdcu.matrix
并复制输出(即原始代码)。
制作你的函数(几乎全部粘贴)
fdcu.matrix2 <- ""paste""
并删除参数,ylim
。
以供参考
fdcu.matrix2 <-
function (x, lband, uband, sim, lQ.thr = 0.7, hQ.thr = 0.2, plot = TRUE,
log = "y", main = "Flow Duration Curve", xlab = "% Time flow equalled or exceeded",
ylab = "Q, [m3/s]", ylim, yat = c(0.01, 0.1, 1), xat = c(0.01, ...
^^^^^ delete!!
例子
require(hydroTSM)
fdcu.matrix2(m.fdc01[,-1], lband=m.fdc01[,-1], uband=m.fdc01[,-1], sim=m.fdc01[,-1],
plot=TRUE, main ="fdcu.matrix2_test", xlab="xlab", ylab="Q, [m3/s]",
ylim=c(1,50), yat=c(0.01,0.02,0.05, 0.1,0.2,0.5, 1,2,5,10,20,50),
bands.col="white", leg.txt="", leg.cex=0.5, leg.pos="auto",
cex.axis=0.7, thr.shw=FALSE)
# [note] yat and pretty(ylim) are ylabels
# [note2 (edited)]
# when log = "y", ylim[1] is disregarded and 0.01 is used instead of it.
我正在尝试使用 fdcu.matrix 函数使用包 hydroTSM 绘制流量持续时间曲线。不幸的是,我无法设法增加或减少 y 轴长度。我用 ylim=c(lownumber,highnumber).
试过了当这不起作用时,我尝试将包复制粘贴到 R 中,这样我就可以 运行 它作为一个函数并对其进行调整......但是 fdcu.matrix 不幸的是没有' t 运行 没有 require(hydroTSM)。
(在 https://github.com/cran/hydroTSM/blob/master/R/fdcu.R 可用)
如何手动或自动将 ylim 调整到数据范围..?
这是我的数据矩阵的一部分:
dput(m.fdc01[1:20,1:5])
structure(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 6.45, 6.45, 6.45, 6.45, 6.372, 6.372, 6.529, 7.09, 3.8, 8.015, 8.277, 9.361, 10.41, 10.705, 9.548, 8.811, 9.176, 8.631, 8.542, 8.365, 8.189, 8.102, 7.588, 7.42, 7.254, 7.09, 7.008, 6.927, 6.847, 6.767, 6.687, 6.687, 6.687, 6.687, 6.847, 6.927, 1.008, 6.927, 7.09, 7.758, 8.277, 7.929, 7.843, 7.673, 7.588, 7.588, 7.588, 7.588, 7.588, 7.42, 7.42, 8.811, 9.927, 8.631, 8.189, 7.673, 7.42, 7.254, 7.008, 7.008, 17.397, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 16.782, 15.82), .Dim = c(20L, 5L), .Dimnames = list(NULL, c("DayOfYear", "1970", "1971", "1972", "1973")))
# Plot with multiple flow duration curves & legend:
require(hydroTSM)
fdcu.matrix(m.fdc01[,-1], lband=m.fdc01[,-1], uband=m.fdc01[,-1], sim=m.fdc[,-1], plot=TRUE,
main ="FDC station 1LA04:1970-1978", xlab="% Time flow equalled or exceeded",
ylab="Q, [m3/s]", ylim=c(1,50),yat=c(0.01,0.02,0.05, 0.1,0.2,0.5, 1,2,5,10,20,50,100),
bands.col = "white", col=col_matsel, lwd=mat_lwd,leg.txt="",
leg.cex=0.5,leg.pos="auto",cex.axis=1,thr.shw=FALSE)
legend("bottomleft",legendtextsel,col=col_matsel, lwd=4, y.intersp=1,bty="n",cex=1)
我觉得这是一个错误。我建议您联系开发商。当fdcu.matrix()
在算法中使用fdcu()
时,fdcu.matrix()
并没有把ylim
的信息给fdcu()
。您可以通过复制原始代码并仅删除一个术语来轻松制作 modifid fdcu.matrix()
。
准备
运行 fdcu.matrix
并复制输出(即原始代码)。
制作你的函数(几乎全部粘贴)
fdcu.matrix2 <- ""paste""
并删除参数,ylim
。
fdcu.matrix2 <-
function (x, lband, uband, sim, lQ.thr = 0.7, hQ.thr = 0.2, plot = TRUE,
log = "y", main = "Flow Duration Curve", xlab = "% Time flow equalled or exceeded",
ylab = "Q, [m3/s]", ylim, yat = c(0.01, 0.1, 1), xat = c(0.01, ...
^^^^^ delete!!
例子
require(hydroTSM)
fdcu.matrix2(m.fdc01[,-1], lband=m.fdc01[,-1], uband=m.fdc01[,-1], sim=m.fdc01[,-1],
plot=TRUE, main ="fdcu.matrix2_test", xlab="xlab", ylab="Q, [m3/s]",
ylim=c(1,50), yat=c(0.01,0.02,0.05, 0.1,0.2,0.5, 1,2,5,10,20,50),
bands.col="white", leg.txt="", leg.cex=0.5, leg.pos="auto",
cex.axis=0.7, thr.shw=FALSE)
# [note] yat and pretty(ylim) are ylabels
# [note2 (edited)]
# when log = "y", ylim[1] is disregarded and 0.01 is used instead of it.