I’m currently trying to have a plot which displays various trajectories of time series with a shared x-axis (time).

time <- seq(from=0, to=1, length.out=101)

X1 <- runif(101)
X2 <- runif(101)
X3 <- runif(101)


This creates the output output

I want the three plots in this example to be stacked onto each other with only one x-axis "time". In addition I want the labels of the y-axis "X1", "X2" and "X3" to stay left of the corresponding plot.

I really would appreciate any help and suggestions!

PS: I also already know about the "trick" to remove the x-axis from the two plots at the top, but this makes it hard to vary the number of plots; say I have "X1", "X2", "X3" and "X4" I would have to recalculate the place of the labels of the y-axis and this seems quite hard to me.

Edit: This is an exampe of how it should look:

enter image description here

Anonymous Asked question May 14, 2021