将维恩图输出保存为 svg
Saving a VennDiagram output to svg
我正在尝试使用包 VennDiagram_1.6.20
。
这是我正在使用的代码片段:
library(VennDiagram)
A <- c("AT1G01050", "AT1G01100","AT1G01370","AT1G01510","AT1G01630","AT1G01650","AT1G01820",
"AT1G01920","AT1G01940","AT1G01960","AT1G02090", "AT1G02100","AT1G02120","AT1G02130",
"AT1G02140","AT1G02280","AT1G02410","AT1G02500","AT1G02560","AT1G02690","AT1G02740","AT1G02780",
"AT1G02840","AT1G03330","AT1G03360","AT1G03860","AT1G03900","AT1G03910","AT1G04080","AT1G04170",
"AT1G04190","AT1G04250","AT1G04270", "AT1G04410","AT1G04430","AT1G04480","AT1G04510","AT1G04630",
"AT1G04690","AT1G04710","AT1G04750","AT1G04810","AT1G04820","AT1G04860", "AT1G04870","AT1G04900",
"AT1G04945","AT1G04980","AT1G05055","AT1G05180")
B <- c("AT1G01050","AT1G01100","AT1G01120","AT1G01370","AT1G01510","AT1G01630","AT1G01650","AT1G01820","AT1G01940","AT1G01960","AT1G02090","AT1G02100","AT1G02140","AT1G02280","AT1G02500","AT1G02560","AT1G02690","AT1G02740","AT1G02780","AT1G02840","AT1G03150","AT1G03330", "AT1G03360","AT1G03860","AT1G03870","AT1G03900","AT1G03910","AT1G04080","AT1G04170","AT1G04190","AT1G04250","AT1G04270","AT1G04410", "AT1G04430","AT1G04480","AT1G04510","AT1G04630","AT1G04690","AT1G04730","AT1G04750","AT1G04810","AT1G04860","AT1G04870","AT1G04900","AT1G04945","AT1G04980","AT1G05055","AT1G05180","AT1G05190","AT1G05210")
ect3_roots_vd <- venn.diagram(
x = list(A, B),
filename = "ect3_roots_vd.svg",
height = 10,
width = 10,
resolution = 300,
imagetype = "svg",
units = "in",
category.names = c("roots_ect3" , "roots_te234"),
print.mode = c("raw", "percent"),
main="triple vs single mutant roots - ect3",
main.cex = 2,
fill = c('#a50026', '#fdae61')
)
现在,当我在 Illustrator 中打开文件时,这是我得到的:
但是,如果我 select Finder 中的文件并使用 space 栏在其上显示预览 "clicking",我会得到如下所示的正确图像:
有没有其他人尝试过在 svg 中保存维恩图并遇到同样的问题?
编辑: 我也尝试使用
ggsave(file="test.svg", plot=ect3_roots_vd, width=10, height=10)
Ant it returns 和上面一样的结果: 如果我"click it" 和他space bar 我可以看到情节 但是这次,当我打开它时,Ai 抛出一个错误甚至不打开文件。
我的 R sessionInfo 是:
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.3
所以,我解决了这个问题。我将 filename
参数设置为 NULL
并使用 ggsave
和 device="svg"
保存绘图。现在我可以在 Illustrator 中打开文件并根据需要进行修改。
my_plot <- venn.diagram(x=list(A, B) ,
filename = NULL,
fill=c("#283148", "#913535"),
alpha=c(0.8,0.8),
euler.d = TRUE,
scaled = TRUE,
cat.fontfamily = "sans",
cat.cex = 1,
lwd = c(0.3, 0.3),
category.names=c("A", "B"),
#cat.just=list(c(1,-40) , c(0.4,-40)),
print.mode = c("raw", "percent"),
fontfamily = "sans",
main="Overlap between A and B",
main.fontfamily = "sans",
main.cex = 1,
cex = 0.9,
width = 10,
height = 10,
units = "in")
ggsave(my_plot, file="my_plot.svg", device = "svg")
我正在尝试使用包 VennDiagram_1.6.20
。
这是我正在使用的代码片段:
library(VennDiagram)
A <- c("AT1G01050", "AT1G01100","AT1G01370","AT1G01510","AT1G01630","AT1G01650","AT1G01820",
"AT1G01920","AT1G01940","AT1G01960","AT1G02090", "AT1G02100","AT1G02120","AT1G02130",
"AT1G02140","AT1G02280","AT1G02410","AT1G02500","AT1G02560","AT1G02690","AT1G02740","AT1G02780",
"AT1G02840","AT1G03330","AT1G03360","AT1G03860","AT1G03900","AT1G03910","AT1G04080","AT1G04170",
"AT1G04190","AT1G04250","AT1G04270", "AT1G04410","AT1G04430","AT1G04480","AT1G04510","AT1G04630",
"AT1G04690","AT1G04710","AT1G04750","AT1G04810","AT1G04820","AT1G04860", "AT1G04870","AT1G04900",
"AT1G04945","AT1G04980","AT1G05055","AT1G05180")
B <- c("AT1G01050","AT1G01100","AT1G01120","AT1G01370","AT1G01510","AT1G01630","AT1G01650","AT1G01820","AT1G01940","AT1G01960","AT1G02090","AT1G02100","AT1G02140","AT1G02280","AT1G02500","AT1G02560","AT1G02690","AT1G02740","AT1G02780","AT1G02840","AT1G03150","AT1G03330", "AT1G03360","AT1G03860","AT1G03870","AT1G03900","AT1G03910","AT1G04080","AT1G04170","AT1G04190","AT1G04250","AT1G04270","AT1G04410", "AT1G04430","AT1G04480","AT1G04510","AT1G04630","AT1G04690","AT1G04730","AT1G04750","AT1G04810","AT1G04860","AT1G04870","AT1G04900","AT1G04945","AT1G04980","AT1G05055","AT1G05180","AT1G05190","AT1G05210")
ect3_roots_vd <- venn.diagram(
x = list(A, B),
filename = "ect3_roots_vd.svg",
height = 10,
width = 10,
resolution = 300,
imagetype = "svg",
units = "in",
category.names = c("roots_ect3" , "roots_te234"),
print.mode = c("raw", "percent"),
main="triple vs single mutant roots - ect3",
main.cex = 2,
fill = c('#a50026', '#fdae61')
)
现在,当我在 Illustrator 中打开文件时,这是我得到的:
但是,如果我 select Finder 中的文件并使用 space 栏在其上显示预览 "clicking",我会得到如下所示的正确图像:
有没有其他人尝试过在 svg 中保存维恩图并遇到同样的问题?
编辑: 我也尝试使用
ggsave(file="test.svg", plot=ect3_roots_vd, width=10, height=10)
Ant it returns 和上面一样的结果: 如果我"click it" 和他space bar 我可以看到情节 但是这次,当我打开它时,Ai 抛出一个错误甚至不打开文件。
我的 R sessionInfo 是:
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.3
所以,我解决了这个问题。我将 filename
参数设置为 NULL
并使用 ggsave
和 device="svg"
保存绘图。现在我可以在 Illustrator 中打开文件并根据需要进行修改。
my_plot <- venn.diagram(x=list(A, B) ,
filename = NULL,
fill=c("#283148", "#913535"),
alpha=c(0.8,0.8),
euler.d = TRUE,
scaled = TRUE,
cat.fontfamily = "sans",
cat.cex = 1,
lwd = c(0.3, 0.3),
category.names=c("A", "B"),
#cat.just=list(c(1,-40) , c(0.4,-40)),
print.mode = c("raw", "percent"),
fontfamily = "sans",
main="Overlap between A and B",
main.fontfamily = "sans",
main.cex = 1,
cex = 0.9,
width = 10,
height = 10,
units = "in")
ggsave(my_plot, file="my_plot.svg", device = "svg")