Reputation: 51
I am trying to use the package VennDiagram_1.6.20
.
And this is the snippet of code I am using:
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')
)
Now, when I open the file in Illustrator, this is what I get:
But if I select the file in the Finder and show a preview "clicking" on it with the spacebar the I get the right image that looks like this:
Has anyone else tried saving a venn diagram in svg and had the same problem?
EDIT: I also tried using
ggsave(file="test.svg", plot=ect3_roots_vd, width=10, height=10)
Ant it returns the same result as above: I can see the plot if I "click it" with he space bar but this time, when I open it Ai throws an error and does not even open the file.
My R sessionInfo is:
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.3
Upvotes: 2
Views: 3067
Reputation: 51
So, I solved the problem. I set the filename
argument to NULL
and saved the plot using ggsave
and device="svg"
. Now I can open the file in illustrator and modify it as I prefer.
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")
Upvotes: 3