論文是
Environmental factors shaping the gut microbiome in a Dutch population
數(shù)據(jù)和代碼的github主頁鏈接
https://github.com/GRONINGEN-MICROBIOME-CENTRE/DMP
這個也是數(shù)據(jù)代碼的下載鏈接织堂,可以看目錄結(jié)構(gòu)
https://zenodo.org/record/5910709#.YmAcp4VBzic
今天的推文重復(fù)一下論文中的figure4b
首先是讀取數(shù)據(jù)
plotCorMat <- read.table('health_disease_prediction/diseases_signature_correlation.txt',
header = T,
row.names = 1,
stringsAsFactors = F)
dim(plotCorMat)
plotCorMat[1:3,1:3]
對數(shù)據(jù)集的行名進(jìn)行修改
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"
)
對數(shù)據(jù)集的列名進(jìn)行修改
colnames(plotCorMat) = 1:37
準(zhǔn)備顏色
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
是用來控制坐標(biāo)軸文字的大小的
cl.cex
是用來控制圖例刻度文字大小的
cl 是 colorlabel
這個是論文中提供的代碼出圖苫拍,和最終論文中用到的圖還是有些差別的
下面我們查看corrplot這個包的幫助文檔看看能夠通過修改代碼改成最終論文中的圖的效果
如果需要把圖例放到底部鳞骤,直接添加一個cl.pos = "b"
的參數(shù)
corrplot(as.matrix(plotCorMat),
method = "square",
tl.cex = 0.4,
cl.cex = 0.4,
col = col1(20),
tl.col = "black",
cl.pos = "b")
關(guān)于如何修改圖例的刻度標(biāo)簽暫時沒有找到參數(shù)調(diào)節(jié)采幌,出圖后手動修改吧
更多關(guān)于corrplot包的內(nèi)容可以參考 https://cran.r-project.org/web/packages/corrplot/vignettes/corrplot-intro.html
本期推文的示例數(shù)據(jù)和代碼可以在公眾號后臺留言20220429獲取
歡迎大家關(guān)注我的公眾號
小明的數(shù)據(jù)分析筆記本
小明的數(shù)據(jù)分析筆記本 公眾號 主要分享:1、R語言和python做數(shù)據(jù)分析和數(shù)據(jù)可視化的簡單小例子陪拘;2裳涛、園藝植物相關(guān)轉(zhuǎn)錄組學(xué)咐吼、基因組學(xué)、群體遺傳學(xué)文獻(xiàn)閱讀筆記;3豪嚎、生物信息學(xué)入門學(xué)習(xí)資料及自己的學(xué)習(xí)筆記搔驼!