简体   繁体   English

如何包含来自不同矩阵的p-vlaues并更改corrplot中的圆形/正方形大小?

[英]How to include p-vlaues from a different matrix and change the size of circles/squares in corrplot?

Users, 用户,

I have two matrices "mm" and "mpm" of same size. 我有两个大小相同的矩阵“ mm”和“ mpm”。 The "mm" matrix contains pre-computed spearman's-rho correlation values and the "mpm" matrix contains the p-value corresponding to the correlation values. “ mm”矩阵包含预先计算的斯皮尔曼-rho相关值,“ mpm”矩阵包含对应于相关值的p值。

> mm[1:5,1:5]
                          X572413     X573110    X358104     X570507
ENSG00000138755        -0.3197926  0.04386737 -0.3789759 -0.33553003
ENSG00000024048        -0.3596203  0.07819836 -0.4008268 -0.50528885
ENSG00000128849         0.2348660 -0.04513889  0.2273856  0.06665028
ENSG00000163827         0.3971051 -0.16466158  0.1864152  0.16520154
ENSG00000154451        -0.2899219 -0.03560250 -0.3721475 -0.36401305
                    X361966
ENSG00000138755 -0.08492661
ENSG00000024048 -0.35552037
ENSG00000128849  0.15638211
ENSG00000163827  0.13412548
ENSG00000154451 -0.10718324

> mpm[1:5,1:5]
                          X572413 X573110 X358104 X570507 X361966
ENSG00000138755             0.161   0.835   0.078   0.132   0.720
ENSG00000024048             0.118   0.705   0.078   0.028   0.114
ENSG00000128849             0.304   0.849   0.324   0.771   0.485
ENSG00000163827             0.086   0.475   0.430   0.494   0.548
ENSG00000154451             0.200   0.881   0.081   0.108   0.646

I want the p-values from the "mpm" to be plotted on the cells. 我希望将“ mpm”中的p值绘制在单元格上。 And when I use the following code: 当我使用以下代码时:

> corrplot(mm, is.corr = FALSE, method = "circle", p.mat = mpm[[1]], insig = "p-value", sig.level=-1)

I get this this error: 我得到这个错误:

Error in ind[, 2] : incorrect number of dimensions

Can anyone help me with this ? 谁能帮我这个 ? Also, is it possible to alter the size of the cells based on p-values ? 另外,是否可以根据p值更改像元的大小? Thanks in advance for any help. 在此先感谢您的帮助。

You need to convert mm and mpm to matrix . 您需要将mmmpm转换为matrix

library(corrplot)
corrplot(as.matrix(mm), is.corr = FALSE, method = "circle", 
         p.mat = as.matrix(mpm), insig = "p-value", sig.level=-1)

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM