Alan Berezin
Alan Berezin

Reputation: 101

Cannot create new plotting window (device?) with par(new=T)

I want to create a new window for each additional plot in R. I tried

plot(rnorm(20), new=TRUE)

and also

par(new=T)
plot(rnorm(20), new=TRUE)

Neither gives me a new window. Do I really need to create a new device?

Upvotes: 4

Views: 16886

Answers (2)

Greg Snow
Greg Snow

Reputation: 49650

The plot.new() function is used to start a new plot on the current device and will open a default device if there is not a device currently open. If you want a new device (so that you have the old plot in one window and the new plot in another window) then use dev.new() or other device functions.

Upvotes: 12

Stedy
Stedy

Reputation: 7469

par(new = T) is used for plotting over an existing plot. You will need to create a new device for each plot, closed with dev.off(). If you want multiple plots in the same window, try using par(mfrow=c(2,2) for 2 rows of 2 plots.

Upvotes: 2

Related Questions