[英]Transpose plots on a graphics device R
par(mfrow=c(3,2))
plot(density(rnorm(100)))
plot(density(rexp(100)))
plot(density(rnorm(100)))
plot(density(rexp(100)))
plot(density(rnorm(100)))
plot(density(rexp(100)))
This gives me a 3x2 array of 6 plots. 这使我得到了一个由6个图组成的3x2数组。 Can I transpose this array without redoing my code?
我可以在不重做代码的情况下转置此数组吗? (The original code that produced the plots is quite a bit more complicated than the above :) -- I am trying to beamer-ize something made for a latex A4 doc.)
(生成图表的原始代码比上述代码要复杂得多:)-我正在尝试对为A4乳胶文档制作的内容进行分束。)
Use layout
instead of par(mfrow=...)
for more flexible panelling. 使用
layout
而不是par(mfrow=...)
可获得更灵活的面板。
The layout
equivalent to your 3x2 panel par
call is 相当于您的3x2面板
par
调用的layout
是
layout(matrix(1:6, nrow=3, byrow=TRUE))
plot(...)
plot(...)
plot(...)
...
Change it to the following to transpose the array without having to change the plot
calls 将其更改为以下内容以转置数组,而不必更改
plot
调用
layout(matrix(1:6, 2))
plot(...)
plot(...)
plot(...)
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.