時間:2019年10月15
參考:參考
不廢話直接畫圖!!
1么抗、數(shù)據(jù)準(zhǔn)備類型
CK_leaf CS_leaf CK_root CS_root
MSTRG.26 MSTRG.26 MSTRG.26 MSTRG.26
MSTRG.31 MSTRG.31 MSTRG.31 MSTRG.31
MSTRG.53 MSTRG.53 MSTRG.46 MSTRG.53
MSTRG.116 MSTRG.103 MSTRG.53 MSTRG.116
MSTRG.124 MSTRG.116 MSTRG.114 MSTRG.124
MSTRG.167 MSTRG.124 MSTRG.116 MSTRG.152
MSTRG.202 MSTRG.167 MSTRG.124 MSTRG.167
MSTRG.227 MSTRG.172 MSTRG.167 MSTRG.172
MSTRG.266 MSTRG.202 MSTRG.202 MSTRG.184
2苹祟、VennDiagram包繪制維恩圖
1砸抛、一維韋恩圖繪制
setwd("I:/FPKM_lncRNA/lncRNA_VennDiagrem")
library("VennDiagram")
#install.packages("VennDiagram")
#清楚環(huán)境中的變量
rm(list = ls())
#讀取數(shù)據(jù)
data <- read.csv("VennDiagram.csv", header = T)
head(data)
#繪制一維韋恩圖
venn.plot <- venn.diagram(
x = list(CK_leaf=data$CK_leaf),
filename = "1single_venn.tiff",
col = "black", #邊框顏色
lwd = 5, #邊框線寬度
fontface = "bold", #標(biāo)簽字體
fill = "grey", #填充顏色
alpha= 0.7, #透明度
cex = 4, #標(biāo)簽字體大小
cat.cex =3, #類名字體大小
cat.fontface = "bold", #類名字體
margin = 0.04 #邊際距離
)
在繪制韋恩圖后會在路徑文件夾中出現(xiàn)相應(yīng)的圖形和數(shù)據(jù),可以忽略树枫,往后走直焙。
2、二維韋恩圖繪制
venn.plot <- venn.diagram(
x = list(
CK_leaf = data$CK_leaf,
CK_root = data$CK_root,
),
filename = "2double_Venn.png", imagetype = "png",
lwd = 3,
fill = c("cornflowerblue", "darkorchid1"),
alpha = 0.6,
label.col = "white",
cex = 1.5,
fontfamily = "serif",
fontface = "bold",
cat.col = c("cornflowerblue", "darkorchid1"),
cat.cex = 2,
cat.fontfamily = "serif",
cat.fontface = "bold",
margin = 0.05,
cat.dist = c(0.03, 0.03),
cat.pos = c(-20, 20)
)
在此步輸入命令后砂轻,會有錯誤提示奔誓,并不會直接出圖,你問為什么搔涝,我也不知道厨喂,提示為如下:
Error in list(CK_leaf = data$CK_leaf, CK_root = data$CK_root, ) :
argument 3 is empty
在路徑文件夾中會有相關(guān)的文件輸出和措,此提示不管,直接往下走杯聚。
3臼婆、三維韋恩圖繪制
#繪制三維韋恩圖
venn.plot <- venn.diagram(
x = list(
CK_leaf = data$CK_leaf,
CS_root = data$CS_root,
),
filename = "3triple_Venn.tiff",
col = "transparent",
fill = c("red", "blue", "green"),
alpha = 0.5,
label.col = c("darkred", "white", "darkblue", "white",
"white", "white", "darkgreen"),
cex = 2.5,
fontfamily = "serif",
fontface = "bold",
cat.default.pos = "text",
cat.col = c("darkred", "darkblue", "darkgreen"),
cat.cex = 2.5,
cat.fontfamily = "serif",
cat.dist = c(0.06, 0.06, 0.03),
cat.pos = 0
)
4、四維韋恩圖繪制
繪制四維韋恩圖
venn.plot <- venn.diagram(
x = list(
CK_leaf = data$CK_leaf,
CS_root = data$CS_root,
),
filename = "4quadruple_Venn.tiff",
col = "black",
lty = "dotted", #邊框線型改為"dotted"虛線
lwd = 3, # 邊框線的寬度
fill = c("cornflowerblue", "green", "yellow", "darkorchid1"),
alpha = 0.50,
label.col = c("orange", "white", "darkorchid4", "white", "white", "white",
"white", "white", "darkblue", "white",
"white", "white", "white", "darkgreen", "white"),
cex = 2.0,
fontfamily = "serif",
fontface = "bold",
cat.col = c("darkblue", "darkgreen", "orange", "darkorchid4"),
cat.cex = 1.8,
cat.fontface = "bold",
cat.fontfamily = "serif"
)
注:此代碼可以繪制六維韋恩圖幌绍,但是需要在步驟2-3-4維中加入更多的變量信息颁褂,主要加入地方:
x = list(
CK_leaf = data$CK_leaf,
CS_root = data$CS_root,
****** = data$****,
****** = data$****,
5、合并圖形
venn.plot <- venn.diagram(
list(CK_leaf=data$CK_leaf,CS_leaf=data$CS_leaf,CK_root=data$CK_root,CS_root=data$CS_root),
filename = "out5venn.tiff",
lty = "dotted",
lwd = 2,
col = "black", #"transparent",
fill = c("dodgerblue", "goldenrod1", "darkorange1", "seagreen3"),
alpha = 0.60,
cat.col = c("dodgerblue", "goldenrod1", "darkorange1", "seagreen3"),
cat.cex = 0.8,
cat.fontface = "bold",
margin = 0.07,
cex = 0.8
)
最后出圖傀广,圖形在路徑文件夾中颁独,但是在每一步繪制過程中,在R中并不顯示出來伪冰,不知道為什么誓酒?