[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)
包。图如下:
Ref:https://stackoverflow.com/questions/14243609/problems-with-venndiagram
本文来自博客园,作者:生物信息与育种,转载请注明原文链接:https://www.cnblogs.com/miyuanbiotech/p/11610055.html。若要及时了解动态信息,请关注同名微信公众号:生物信息与育种。