0
点赞
收藏
分享

微信扫一扫

[R] venn.diagram保存pdf格式文件?

vennDiagram包中的主函数绘图时,好像不直接支持PDF格式文件:

dat = list(a = group_out[[1]][,1],b = group_out[[2]][,1])
names(dat) <- group_names[1:2]

venn.plot <- venn.diagram(
dat,
filename = "proteinGroup_venn.tiff", #pdf error
imagetype = "tiff", #pdf error
lwd = 3,
col = "transparent",
fill = c("cornflowerblue", "darkorchid1"),
alpha = 0.6,
label.col = "black",
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)
)

直接使用pdf保存矢量图时不行,只能用tiff等其他矢量图格式。但在函数外结合grid.draw可以保存:

venn.plot <- venn.diagram(
dat,
filename = NULL, #设为空
lwd = 3,
col = "transparent",
fill = c("cornflowerblue", "darkorchid1"),
alpha = 0.6,
label.col = "black",
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)
)

pdf(file="proteinGroup_venn.pdf")
grid.draw(venn.plot)
dev.off()

如果不行,先安装加载​​library(grDevices)​​​包。图如下:
[R] venn.diagram保存pdf格式文件?_加载

作者:​​Bioinfarmer​​。若要及时了解动态信息,请关注同名微信公众号:Bioinfarmer。


举报

相关推荐

0 条评论