I would like to overlay two plots:
plot1
t1 <- c(0,1,2,3,4,5,6,7,8,9,10)
d1 <- c(0,2,4,6,8,10,12,14,16,18,20)
plot2
You can use lines
for the second plot (instead of plot
). Furthermore, we scale the x-axis values of the second plot (t2
) with 2 (I(2 * t2)
).
plot(d1 ~ t1, col="black", type="l", xlim=c(0,10))
lines(d2 ~ I(2 * t2), col="black", type="l", xlim=c(0,5))
In this way, the x-range of the second plot is identical to the x-range of the first one.