如何放大corrplot中的相关图?

问题描述 投票:0回答:1

我按照以下步骤创建相关图:

library(corrplot)

c_df <- Hmisc::rcorr(cor(df), type='spearman')
M = c_df$r[1:3, 4:80]
p.mat = c_df$P[1:3, 4:80]

corrplot(M, method="color", col=col, addCoef.col = "black", tl.col="black",
         p.mat = p.mat, sig.level = 0.05, insig = "blank", diag=FALSE )

但结果并不真正可见。我还使用

png()
函数来分配宽度和高度,但它给了我相同的结果。

corrplot

输入为:

df = structure(list(hsa.miR.101.3p = c(11.6, 11.8, 11.5, 11.2, 11.5, 
11.7, 11.8, 11.4, 10.9, 10.9, 11.3, 11.3, 11.4, 11.1, 11.4, 11.4, 
11.8, 11.3, 11.6, 11.7, 12.7), hsa.miR.23a.3p = c(13.9, 13.6, 
14, 13.3, 13.9, 13.8, 13.7, 14, 13.4, 13.4, 14.1, 13.6, 14, 13.5, 
13.8, 13.5, 14.2, 14, 14.3, 14.4, 13.4), hsa.miR.424.5p = c(14.4, 
13.9, 14, 14.3, 14.1, 13.6, 13.8, 14.3, 13.8, 13.8, 14.2, 14.5, 
14.2, 14.1, 14.5, 15.3, 14.5, 14.4, 14.5, 14.2, 15.3), CFTR = c(6, 
7.2, 6, 5.9, 6, 5.9, 6.4, 6.5, 7.2, 6.2, 5.9, 5.5, 6.1, 8, 6.6, 
5.6, 6.5, 5.9, 6.4, 6.7, 5.9), ITGA3 = c(11.9, 11.8, 12, 11.7, 
12.1, 11.8, 11.9, 11.8, 11.9, 12.2, 11.5, 11.7, 11.9, 11.8, 12.1, 
11.7, 12.1, 12, 12.2, 12.2, 12), ST7L = c(8.1, 8.1, 8.3, 8.2, 
8.2, 8.2, 8.2, 8.2, 8.1, 7.9, 8.2, 8.4, 8.6, 8.2, 8.6, 8.3, 8.2, 
8.4, 8.5, 8.4, 8.2), ANLN = c(9, 8, 8.9, 8.8, 8.9, 8.4, 9.7, 
9.3, 10.1, 9.2, 9.1, 9.7, 9.1, 9.4, 9.1, 8, 9.3, 9.1, 8.8, 9, 
8.6), FAS = c(8.9, 7.8, 8, 8.3, 8.1, 8.7, 8, 8.8, 8, 8.6, 8.2, 
9, 9.1, 8.3, 8.3, 8.2, 8.2, 8.7, 8, 8.2, 7.9), CDH1 = c(12.5, 
12.7, 12.6, 12.4, 12.5, 12.4, 12.8, 12.8, 13, 12.9, 12.5, 12.7, 
12.9, 12.6, 12.5, 12.7, 12.9, 12.8, 12.1, 12.6, 12.3), PIK3CB = c(10.8, 
10.6, 10.9, 10.6, 10.9, 10.5, 10.4, 10.5, 10.5, 10.6, 10.2, 10.6, 
10.5, 10.7, 11.2, 10.4, 10.9, 11, 10.9, 11, 10.2), PRDM1 = c(7.1, 
7, 6.4, 7, 7.2, 6.8, 7.1, 6.9, 6.7, 7.7, 6.3, 7.1, 7.4, 6.9, 
7.3, 7, 8.3, 6.7, 7, 7.1, 6.7), SPI1 = c(9.5, 9.6, 9.6, 10, 8.8, 
9.6, 9.5, 9.5, 9.3, 9.1, 9.7, 9.7, 9.4, 9.3, 9.3, 9.8, 9.4, 9.4, 
9.2, 8.8, 9.4), KLF6 = c(11.8, 11.7, 11.4, 11.7, 11.4, 11.5, 
11.7, 11.1, 11.5, 11.7, 11.6, 12.2, 11.8, 11.6, 11.4, 11.8, 12, 
11.8, 11.7, 11.3, 11.6), RHOA = c(12.4, 12.2, 12.4, 12.5, 12.2, 
12.3, 12.3, 12.4, 12.8, 12.3, 12.4, 12.4, 12.3, 12.3, 12.4, 12.3, 
12.3, 12.3, 12.3, 12.3, 12.5), TGFBR3 = c(13, 13.3, 13.4, 12.9, 
13.2, 12.9, 12.5, 12.4, 11.8, 12.5, 12.2, 12.5, 12.8, 12.8, 13, 
12.9, 12.8, 13, 13.6, 13, 12.2), PTGS2 = c(8.5, 7.2, 8.3, 8.5, 
8.9, 8.7, 7.4, 7.5, 6.2, 6.3, 8.8, 10.6, 6.6, 7.3, 6.7, 9.3, 
7.1, 7.5, 8.7, 6.6, 6.7), EED = c(8.9, 8.9, 8.8, 8.8, 8.8, 8.6, 
8.8, 8.8, 9.3, 8.8, 9, 9, 8.9, 9, 8.8, 8.8, 8.7, 8.9, 8.8, 8.9, 
8.4), FGFR1 = c(11.3, 11.8, 11.3, 11.9, 11.6, 11.9, 11.7, 11.7, 
11.7, 11.5, 11.8, 11.9, 11.8, 11.7, 11.5, 12, 12.3, 11.5, 11.2, 
11.4, 11.9), CDC14A = c(8.4, 8.5, 8.3, 8.1, 8.3, 8.1, 8.2, 8.5, 
8.2, 8.2, 8, 8.3, 8.1, 8.1, 8.4, 8.2, 8.4, 8.1, 8.4, 8.6, 8.1
), HSP90AA1 = c(13.9, 14, 13.5, 13.4, 14, 13.8, 13.5, 13.4, 13.7, 
13.9, 13.5, 13.5, 13.7, 14, 14.2, 13.3, 14, 13.7, 13.7, 14, 13.5
), MEF2C = c(10, 9.9, 10.3, 10.5, 9.8, 10.5, 10.5, 10.5, 10.2, 
10.2, 10.3, 10.3, 10.5, 10.2, 10.2, 10.6, 10.3, 9.9, 9.8, 10.2, 
9.8), NLK = c(9, 8.8, 9.1, 9, 8.8, 9, 9, 9, 8.9, 9, 9.1, 8.9, 
9, 8.9, 8.9, 9, 9.1, 8.9, 9.2, 9.1, 8.6), JAK2 = c(9.7, 9.3, 
10, 9.2, 9.3, 9.8, 9.5, 9.4, 8.5, 9, 10.1, 9.6, 9.5, 9.1, 9.3, 
9.7, 9.1, 9.8, 10.1, 9.3, 9), HIF1A = c(10.8, 10.8, 10.9, 11.2, 
10.8, 10.9, 11, 10.9, 10.6, 11.5, 10.9, 10.9, 11.3, 10.8, 11.1, 
11, 11, 10.8, 10.8, 10.8, 10.4), SMAD7 = c(10.3, 10.9, 10.8, 
10.4, 10.7, 10.3, 10.2, 10.4, 10.1, 10.3, 10.2, 9.9, 10.4, 10.1, 
10.4, 10.3, 10.3, 10.4, 10.9, 10.4, 10.7), XIAP = c(9.7, 9.8, 
9.9, 9.8, 9.9, 9.7, 9.6, 9.7, 9.4, 9.8, 9.7, 9.4, 9.8, 9.7, 9.9, 
9.7, 9.8, 9.5, 9.9, 9.9, 9.7), FMR1 = c(11, 11.4, 11.1, 10.6, 
11.6, 11, 10.9, 11, 10.3, 10.9, 10.2, 10.4, 11.1, 10.9, 11.2, 
10.7, 11.1, 11.3, 11.5, 11.5, 11), EYA1 = c(5.5, 5.1, 5.4, 5.4, 
5.7, 5.3, 5.5, 5.3, 5.3, 5.4, 5.4, 5.9, 5.3, 5.4, 5.3, 5.2, 5.3, 
5.6, 5.5, 5, 5.3), CCNE1 = c(9.7, 9.1, 9.3, 9.6, 10.4, 9.5, 10.3, 
9.8, 10.6, 10, 9.6, 10.2, 10.4, 10.1, 10, 9.7, 10.2, 9.7, 9.2, 
9.7, 9.8), CDK6 = c(10.7, 10.9, 10.6, 11, 10.5, 10.7, 11.1, 11.1, 
10.9, 11, 11.1, 10.8, 10.9, 11, 10.8, 11.2, 10.7, 10.7, 10.3, 
10.9, 10.7), MET = c(11.5, 11.5, 11.5, 11.3, 11.1, 11.1, 11.6, 
11.7, 11.4, 11.3, 11.6, 11.8, 11.4, 11.3, 11.2, 11.9, 11.5, 11.6, 
11.3, 11.5, 11), EZH2 = c(8.7, 8.3, 8.7, 8.7, 8.9, 8.5, 9.2, 
8.8, 9.4, 8.6, 8.6, 9.4, 8.7, 8.7, 8.4, 8.3, 8.7, 8.8, 8.6, 8.5, 
8.5), CXCL12 = c(7.6, 7.1, 7.1, 8.2, 6.8, 6.5, 7.4, 7.6, 7.9, 
6.5, 8, 6.5, 7.3, 7.1, 6.4, 8.1, 8, 7.4, 6.4, 7.8, 8), CUL2 = c(10.3, 
10.1, 10.3, 10, 10.6, 10.1, 9.9, 10, 10, 9.9, 9.7, 9.6, 10.2, 
10.3, 10.3, 10, 10, 10.1, 10.4, 10.6, 9.7), MYH1 = c(4.7, 4.7, 
4.7, 4.7, 4.7, 4.7, 4.7, 4.7, 4.7, 5, 4.7, 4.7, 4.7, 5, 4.7, 
4.7, 4.7, 5, 4.7, 4.7, 4.7), KLF3 = c(10.4, 10.5, 10.4, 10.7, 
10.4, 10.6, 10.4, 10.6, 10.2, 10.4, 10.5, 10.5, 10.7, 10.6, 10.8, 
10.7, 10.3, 10.7, 10.8, 10.7, 10.2), PPARGC1A = c(5.4, 5.2, 4.7, 
5.1, 5.4, 5.1, 5.6, 5.1, 5.1, 5.3, 4.7, 5.5, 4.7, 5.1, 5.2, 5.1, 
5.4, 5.2, 5.2, 5, 5), CCND1 = c(11.3, 11, 11.1, 11.9, 10.5, 11.8, 
12.4, 12, 12.7, 12.4, 11.6, 11.4, 12.1, 11.7, 11.4, 11.6, 11.9, 
11.5, 10.9, 11.9, 12.1), ATP5F1B = c(13.3, 13.1, 13.2, 13.1, 
13.1, 13.1, 13.2, 12.9, 13.6, 13.3, 13.1, 13.5, 13.1, 13.1, 13, 
13.1, 13.1, 13.2, 13.1, 13, 12.9), LDHB = c(9.3, 8.7, 8.6, 9.5, 
7.6, 8.5, 9.1, 9, 10.4, 8.9, 9.2, 9.6, 9.4, 9, 8.5, 9.1, 8.8, 
8.7, 8.4, 8.6, 9.2), PRKAB1 = c(10, 9.7, 9.6, 9.8, 9.8, 10, 10, 
9.7, 9.8, 10, 9.7, 10.1, 9.7, 9.7, 10.1, 10, 10, 9.9, 9.9, 9.8, 
10.2), CCND3 = c(11.3, 11, 11.1, 11.1, 11, 11.3, 11.1, 10.9, 
11.8, 11.7, 11.4, 11.8, 11.4, 11.2, 11.3, 11, 11.2, 11, 10.9, 
11.1, 10.9), SRF = c(10.8, 10.6, 10.1, 10.7, 10.6, 10.5, 10.3, 
10, 10.5, 11, 10.3, 10.7, 10.9, 10.3, 10.8, 10.5, 10.9, 10.7, 
10.2, 10.2, 10.5), VEGFA = c(10.6, 10.4, 10.6, 11, 10.4, 11.4, 
9.3, 9.2, 8.7, 9.4, 11.8, 12, 9.5, 10.3, 9.5, 12.1, 9.8, 9.6, 
10.8, 9.3, 9.2), SMAD5 = c(9.8, 9.8, 9.8, 10.1, 9.7, 9.9, 10, 
10.1, 10.1, 9.7, 10.3, 9.9, 9.9, 9.9, 9.7, 10.3, 9.8, 9.8, 9.7, 
9.9, 9.8), HES1 = c(9.9, 10.6, 10.1, 9.8, 10.7, 10.3, 9.5, 10.3, 
9.7, 10.4, 9.1, 9, 9.9, 10.2, 10.6, 9.5, 10, 10, 9.9, 10.6, 10.7
), GLS = c(9.3, 9.4, 9.5, 9.8, 9.3, 9.3, 9.9, 10, 9.8, 9.8, 9.5, 
9.8, 9.6, 10.2, 10, 9.9, 9.6, 9.6, 9.5, 9.8, 9.6), KDM5B = c(11.4, 
11.5, 11.6, 10.9, 11.5, 11.3, 10.9, 11, 10.8, 10.9, 10.9, 10.7, 
11.1, 11.1, 11.4, 10.9, 11.3, 11.3, 11.6, 11.4, 11), STMN1 = c(11.3, 
10.6, 11.2, 11, 11, 10.8, 11.4, 11.5, 12.1, 11.2, 11.2, 11.7, 
11.2, 11.1, 10.7, 10.8, 11.1, 11.2, 11.1, 10.8, 11), ATF6 = c(11.3, 
11.2, 11.4, 10.9, 11.2, 11.3, 11.1, 11, 10.9, 11.2, 10.9, 11, 
11.1, 11.2, 11.2, 11.1, 11.3, 11.2, 11.5, 11.4, 10.7), MYB = c(6, 
6.1, 5.8, 6.1, 6, 5.8, 6.5, 6.1, 6.7, 6, 6, 6.3, 5.9, 6.2, 5.7, 
5.8, 5.9, 6.1, 5.7, 5.7, 5.8), FOXO3 = c(9.9, 9.6, 10.5, 9.6, 
9.5, 9.8, 9.2, 9.3, 8.9, 9.2, 10.1, 10.2, 9.4, 9.4, 9.3, 9.8, 
9.1, 10.3, 10.4, 9.2, 9.3), NEK6 = c(9.3, 9.5, 9.4, 9.9, 9.5, 
9.5, 9.8, 9.9, 9.8, 9.7, 9.7, 9.8, 10, 10.2, 10.2, 10.1, 9.7, 
9.4, 9.1, 9.8, 9.8), DNMT3A = c(11.8, 11.9, 11.7, 11.4, 11.9, 
11.7, 11.6, 11.5, 11.3, 11.7, 11.4, 10.9, 11.8, 11.6, 11.5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.9, 8.9, 8.8, 9, 8.8, 
8.6), RAC1 = c(11.9, 11.7, 11.9, 11.8, 11.7, 11.8, 11.7, 11.8, 
12.2, 11.8, 11.9, 12, 11.8, 11.8, 11.8, 11.9, 11.9, 11.8, 11.9, 
11.7, 11.7), PIM1 = c(11.5, 11.6, 11.8, 10.8, 11.9, 11.6, 11.3, 
11, 11, 11.3, 11.1, 10.3, 11.5, 11, 11.3, 11, 11.7, 11.3, 12.2, 
11.9, 11.3), ATAT1 = c(10.6, 10.6, 10.5, 10.5, 10.6, 10.5, 10.8, 
10.8, 10.7, 10.9, 10.7, 10.7, 10.7, 10.5, 10.5, 10.6, 10.4, 10.7, 
10.1, 10.3, 10.7), KIF23 = c(9, 7.8, 8.6, 8.6, 8.8, 8.5, 9.4, 
9.1, 9.9, 9.1, 8.8, 9.6, 9, 8.9, 9, 8.2, 9, 9, 8.4, 8.7, 8.5), 
    FGF2 = c(6.9, 7.4, 7.5, 7.9, 7, 7.3, 7.8, 7.5, 7.3, 7.6, 
    7.9, 6.8, 7.2, 7.4, 7.9, 7.5, 7.3, 7.1, 7.3, 7.2, 7.3), APP = c(14.3, 
    14, 14.4, 13.9, 13.7, 14, 14, 14, 14.4, 13.9, 14.5, 14.5, 
    14, 14, 13.8, 14.2, 14.1, 14.1, 14, 14, 14), RGS5 = c(8.9, 
    8.1, 8.1, 9.1, 8.4, 8.6, 10.1, 9.5, 9, 9.4, 9.2, 9.2, 9.8, 
    9.1, 8.1, 7.9, 9.7, 10.5, 7.5, 8.9, 8.9)), row.names = c("Control1", 
"Control2", "Control3", "Control4", "Control5", "Control6", "Control7", 
"Control8", "Control9", "Control10", "Control11", "Control12", 
"Control13", "Control14", "Control15", "Control16", "Control17", 
"Control18", "Control19", "Control20", "Control21"), class = "data.frame")

在上面的代码中更改: M = c_df$r[1:3, 4:80] 然后 p.mat = c_df$P[1:3, 4:80]

如何制作一个我们可以正确观看的情节?

r ggplot2 correlation r-corrplot
1个回答
0
投票

80 列对于任何人来说都有点太多了,除非你正在制作海报。对于 A4 尺寸的纸张,您可能需要将列分成两半,并使用

cex
参数减小文本大小:

cor_col <- colorRampPalette(c("green", "grey", "darkorange"))

M_1 = c_df$r[1:3, 4:40]
p.mat_1 = c_df$P[1:3, 4:40]

M_2 = c_df$r[1:3, 41:80]
p.mat_2 = c_df$P[1:3, 41:80]

cex <- 0.6

par(mfrow=c(2,1))
corrplot(M_1, method="color", col=cor_col(10), addCoef.col = "black", tl.col="black",
         p.mat = p.mat, sig.level = 0.05, insig = "blank", diag=FALSE,
         tl.cex = cex, cl.cex=cex, number.cex = cex)

corrplot(M_2, method="color", col=cor_col(10), addCoef.col = "black", tl.col="black",
         p.mat = p.mat_2, sig.level = 0.05, insig = "blank", diag=FALSE,
         tl.cex = cex, cl.cex=cex, number.cex = cex)

给出: enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.