I know I can use par(mfrow=c(1, 2))
to create a plot with a split screen. However, I'd really like to create a plot where 2/3 of the window is used to plot one graph, and 1/3 of the window is used to plot another. Is this possible?
You need to use function layout
instead of par
here, with argument widths
:
layout(matrix(c(1,2),nrow=1), widths=c(2,1))
See ?layout
for more informations.
alternatively:
a <- c(1:10)
b <- c(1:10)
par(fig=c(0, (2/3), 0, 1))
par(new=TRUE)
plot(a, b)
par(fig=c((2/3), 1, 0, 1))
par(new=TRUE)
plot(a, b)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With