Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

abline() not appearing in plot

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)))
 }

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading