random_forest_fanatic
random_forest_fanatic

Reputation: 1252

Split screen (with unequal windows) plotting in R

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?

Upvotes: 8

Views: 9796

Answers (2)

thijs van den bergh
thijs van den bergh

Reputation: 618

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)

Upvotes: 8

plannapus
plannapus

Reputation: 18749

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.

Upvotes: 13

Related Questions