增加基座R中线段之间的垂直空间

I wrote a function that plots a matrix of confidence intervals, and I am trying to increase the space between each segment for each successive interval to avoid overplotting. This means I will have to set my ylim to accommodate the number of intervals in the plot, but I am not sure how to approach this so that it will increment vertically in the loop.

这是我的代码和一些可重现的数据:


set.seed(200)
x <- rnorm(100, 10) 
truemean <- mean(x)

mat <- replicate(100, t.test(sample(x, rep = T))$conf.int) 
mat <- t(mat)

myfunc <- function(mat, truemean) {

  plot(x = c(min(mat[ , 1]), max(mat[ , 2])), 
       y = c(1, 100), 
       type = "n", 
       xlab = "0:100",
       ylab = "0:100")

  abline(v = truemean)

  for (i in 1:nrow(mat)) {

    if (mat[i, 1] <= truemean & mat[i, 2] >= truemean) {

      segments(x0 = mat[i, 1], y0 = i, 
               x1 = mat[i, 2], y1 = i, 
               col = "blue",
               lwd = 2)

    } else {

      segments(x0 = mat[i, 1], y0 = i, 
               x1 = mat[i, 2], y1 = i, 
               col = "red", 
               lwd = 2) 

    }

  }

}

myfunc(mat, truemean)