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?
我知道我可以使用par(mfrow = c(1,2))来创建一个分屏的情节。但是,我真的想创建一个绘图,其中2/3的窗口用于绘制一个图形,窗口的1/3用于绘制另一个图形。这可能吗?
2 个解决方案
#1
12
You need to use function layout
instead of par
here, with argument widths
:
您需要使用函数布局而不是par,参数widths:
layout(matrix(c(1,2),nrow=1), widths=c(2,1))
See ?layout
for more informations.
有关更多信息,请参阅?布局。
#2
7
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)
#1
12
You need to use function layout
instead of par
here, with argument widths
:
您需要使用函数布局而不是par,参数widths:
layout(matrix(c(1,2),nrow=1), widths=c(2,1))
See ?layout
for more informations.
有关更多信息,请参阅?布局。
#2
7
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)