Environmental factors shaping the gut microbiome in a Dutch population
https://github.com/GRONINGEN-MICROBIOME-CENTRE/DMP
https://zenodo.org/record/5910709#.YmAcp4VBzic
今天的推文重复一下论文中的figure4b
image.png
plotCorMat <- read.table('health_disease_prediction/diseases_signature_correlation.txt',
header = T,
row.names = 1,
stringsAsFactors = F)
dim(plotCorMat)
plotCorMat[1:3,1:3]
rownames(plotCorMat) = c("1.Blood.Anemia",
"2.Blood.Thrombosis",
"3.Cancer.Any",
"4.Cardiovascular.Arrythmia.MedDiagnosed",
"5.Cardiovascular.Colesterol.high",
"6.Cardiovascular.Heart.Attack",
"7.Cardiovascular.Heart.Failure.Disorder",
"8.Cardiovascular.Heartrate.complains",
"9.Cardiovascular.Hypertension",
"10.Endocrine.DiabetesT2",
"11.Gastrointestinal.Stomach.Ulcer",
"12.Hepatologic.Gallstones",
"13.Mental.Any",
"14.Mental.Burn.Out",
"15.Mental.Depression",
"16.Mental.Other.anxiety",
"17.Mental.Panic.disorder",
"18.Neurological.Dizziness.Falling",
"19.Neurological.Mental.Fibromyalgia",
"20.Neurological.Migraine",
"21.Other.Autoimmune.Rheumatoid.Artritis",
"22.Other.Chronic.cystitis",
"23.Other.Chronic.Inflammation.Throatnose",
"24.Other.Chronic.Muscle.Weakness",
"25.Other.Fractures",
"26.Other.Incontinence",
"27.Other.Kidney.Stones",
"28.Other.Osteoarthritis",
"29.Other.Osteoporosis",
"30.Other.RSI",
"31.Pulmonary.Autoimmune.Asthma",
"32.Pulmonary.COPD",
"33.Skin.Autoimmune.Atopic.dermatitis",
"34.Skin.Autoimmune.Psoriasis",
"35.Skin.Autoimmune.Severe.acne",
"36.Gastrointestinal.Rome3_IBS.Any",
"37.None.NoDiseases"
)
colnames(plotCorMat) = 1:37
col1<-colorRampPalette(c( "#9B2226", "#AE2021","#BB3E03","#CA6702","#FFFFFF",
"#90e0ef", "#0077b6","#023e8a","#001219"))
col1(3)
col1(10)
library(corrplot)
corrplot(as.matrix(plotCorMat),
method = "square",
tl.cex = 0.85,
cl.cex = 0.85,
col = col1(20),
tl.col = "black")
这里 tl.cex
是用来控制坐标轴文字的大小的cl.cex
是用来控制图例刻度文字大小的
cl 是 colorlabel
image.png
这个是论文中提供的代码出图,和最终论文中用到的图还是有些差别的
下面我们查看corrplot这个包的帮助文档看看能够通过修改代码改成最终论文中的图的效果
如果需要把图例放到底部,直接添加一个cl.pos = "b"
的参数
corrplot(as.matrix(plotCorMat),
method = "square",
tl.cex = 0.4,
cl.cex = 0.4,
col = col1(20),
tl.col = "black",
cl.pos = "b")
image.png
关于如何修改图例的刻度标签暂时没有找到参数调节,出图后手动修改吧
更多关于corrplot包的内容可以参考 https://cran.r-project.org/web/packages/corrplot/vignettes/corrplot-intro.html