我正在尝试使用该plot.variogram功能将文本,线条,较小的刻度线和/或个性化的轴添加到变异函数图中。当我尝试使用传统函数调用(即text(“Text Here”))添加任何一个时,plot.new has not been called yet即使打开了方差图的绘图窗口,它也会返回错误。
这是我的代码:
#v is sample variogram, vmf is fitted model plot(v, model=vmf, xlim=c(0, 65), ylim=c(0,25), xlab="Distance between Point Pairs (km)", ylab="Semivariance ((C/km) )", cex.xlab=6.5, cex.ylab=6.5, cex.xaxis=2.5, cex.main=5.5) #Add a 2 to the y label that is in 10 pt. font so it looks like it is (C/km)^2 par(ps=10, cex=1, cex.main=1) text(-2, 16, labels=2, srt=90) #Add lines showing the desired point pair distance and semivariance for the problem par(new=TRUE, lines(c(53,53),c(0,15),col='red')) par(new=TRUE, lines(c(0, 53),c(15,15),col='red')) #Add axis minor tick marks in increments of 5 axis(side=1, at=c(0, 5, 15, 25, 35, 45, 55, 65), labels = NA, tck=-0.01, pos=0) axis(side=2, at=c(0, 2.5, 7.5, 12.5, 17.5, 22.5, 25),labels = NA, tck=-0.01, pos=0)
我试图通过以下方式“欺骗” R: plot(c(0,65), c(0,25)) 然后运行上面的代码。这允许传统功能起作用,但不幸的是它们不在适当的位置(即x = 5不在x轴上位于5)。
plot(c(0,65), c(0,25))
有什么建议可以更好地“诱骗” R正确绘图吗?是否有将文本,轴等自动添加到方差图的功能?
如果您还有其他想知道的内容,请告诉我。
谢谢!