【问题标题】:abline() not appearing in plotabline() 没有出现在情节中
【发布时间】:2022-11-16 21:40:52
【问题描述】:

出于某种原因,我的 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)))
 }

【问题讨论】:

    标签: r plot


    【解决方案1】:

    这是因为你把abline()放在了xlim里面。

    尝试将最后两行更改为:

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

    【讨论】:

    • 谢谢,但我还有另一个问题,现在在我的直方图上,首先是绿线多于直方图的一个均值。你能帮我解决这个问题吗
    猜你喜欢
    • 2019-06-19
    • 2021-09-01
    • 2020-03-09
    • 2020-08-24
    • 1970-01-01
    • 1970-01-01
    • 2013-02-16
    • 1970-01-01
    • 2017-11-07
    相关资源
    最近更新 更多