R将corrplot返回为对象 [英] R return corrplot as object

查看:89
本文介绍了R将corrplot返回为对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

corrplot绘制一个相关矩阵,但不返回图形对象(毛刺)

corrplot plots a correlation matrix, but it does not return a graphical object (grob)

我想在单个页面上绘制几个相关矩阵.对于普通图,我将使用gridExtra包中的grid.arrange.但是,由于corrplot仅打印而不返回对象,因此我看不到该怎么做.

I would like to plot several correlation matrices on a single page. For normal plots, I would use grid.arrange from the gridExtra package. However since corrplot only prints and does not return an object, I can't see how to do this.

是否有替代方法或更好的替代方法corrplot?

Is there a workaround or a better alternative to corrplot ?

推荐答案

有一个旧的备用数据库par(mfrow=c(x, y)),其中x是要绘制的行数,而y是列数.然后,它在您调用绘图时跨过然后向下发布.

There's the old standby par(mfrow=c(x, y)) where x is the number of rows you wish to plot and y the numberof columns. It then posts across and then down as you call the plots.

par(mfrow = c(2, 2))
corrplot(cor(mat1))
corrplot(cor(mat2))
corrplot(cor(mat3))
corrplot(cor(mat4))

par(mfrow = c(1, 1)) #To clear layout

将情节绘制为

Mat1 | Mat2
-----------
Mat3 | Mat4

这篇关于R将corrplot返回为对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆