繁体   English   中英

abline() 没有出现在 plot 中

[英]abline() not appearing in plot

出于某种原因,我的 abline 没有出现,使用以下代码:

V_max=10
V_min=0
H=1
n=1

par(mfrow=c(length(C)+1,1), mar = c(2,0,2,0),oma = c(1,5,0,0))


V <- function( C, H, n ){
  1 / (1 + (C / H)^n) 
}

x_lim_min=-1
x_lim_max=13


C=c(0,0.01,0.1,1)

mylist <- list()
for(i in 1:length(C)){
V_C <- V_max*V(C[i],H,n)
x3 <- rnorm(100,V_C,1)
mylist[i] <- mean(x3)
y3 <- hist(x3, plot=FALSE,breaks=20)
maans_to_hist <- unlist(mylist)
plot(y3, col='gray48',xlim=c(x_lim_min,x_lim_max, abline(v=maans_to_hist,col='forestgreen',lwd=3)))
 }

这是因为您将abline()放在xlim中。

尝试将最后两行更改为:

plot(y3, col='gray48', xlim=c(x_lim_min,x_lim_max))
abline(v=maans_to_hist,col='forestgreen',lwd=3)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM