I simply want to stack two simple line plots in base R. Here is what I tried:
x <- c(1:100)
y <- c(100:1)
old.par <- par(mfrow = c(2, 1))
plot(x, y)
plot(x, y)
par(old.par)
I used this method in the past successfully, but this time R throws me an error when I call plot(x, y)
:
Error in plot.new() : figure margins too large
. If I call plot(x,y)
without par(...)
beforehand, there is no error.
it's work for me plot
If you get this message in RStudio, clicking the 'broomstick' figure "Clear All Plots" in Plots tab and trying plot() again may work.