1

I have a code with several plots, some of them are in layouts and others stand alone. The problem is when I draw a layout, the next plots, that must be alone, appears in the previous layout arrangement. How can I stop the layout arrangement for the plots after a layout?

layout(matrix(c(1,2,3,4), 2, 2))
plot(1:10)
plot(10:100)
plot(100:1000)
plot(1000:10000)


#Plots that I dont't want into a layout

plot(1, main = "Example 1")

plot(2, main = "Example 2")

When I run the entire code, I expected in the Rstudio window, a layout and then 2 separated plots, but I get:

enter image description here

and

enter image description here

Daniel Valencia C.
  • 2,159
  • 2
  • 19
  • 38

1 Answers1

2

We can run the following line to reset the plot device setting.

par(mfrow=c(1, 1))

After that, run the code you provided and the plots are all in single frame.

plot(1, main = "Example 1")

enter image description here

plot(2, main = "Example 2")

enter image description here

www
  • 38,575
  • 12
  • 48
  • 84