Multiple plots are not rendered as described by layout.show

Using the raster package and its plot function, I want to arrange six plots of Raster* objects in 2 rows and 3 columns, by columns. Therefore I set up my layout like this:

layout(mat=matrix(1:6, nrow=2, ncol=3), heights=c(1,1), widths=c(2,1,1))

Calling layout.show(6) results in this preview, which is exactly what I want:

enter image description here

However, after the first plot being placed where the 1 is (as expected), the second plot is placed where the 3 is (not as expected). Why's that?

When I then call layout.show(6) again, I get this, which is NOT what I want:

enter image description here

Interestingly, using par(mfcol=c(2,3)) instead of layout also placed the plots by row (i.e. behaved like mfrow).

(I'm aware I could just rearrange the order of plot calls, but I want to know why this doesn't work as I expect it to.)



from Recent Questions - Stack Overflow https://ift.tt/3EJqzAP
https://ift.tt/3pG7HP1

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Object oriented programming concepts (OOPs)

Spring Webflux : How to return HTTP 200 response with body when the called service returns HTTP 201 without body with WebClient?