4

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?

rcs
  • 67,191
  • 22
  • 172
  • 153
Alan Berezin
  • 101
  • 1
  • 1
  • 4

2 Answers2

12

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.

Roman Byshko
  • 8,591
  • 7
  • 35
  • 57
Greg Snow
  • 48,497
  • 6
  • 83
  • 110
2

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.

Stedy
  • 7,359
  • 14
  • 57
  • 77