For some reason my abline doesn't show up, using this code:
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)))
}
CodePudding user response:
It's because you put abline()
inside xlim
.
Try changing last two lines to:
plot(y3, col='gray48', xlim=c(x_lim_min,x_lim_max))
abline(v=maans_to_hist,col='forestgreen',lwd=3)