Maya Gosztyla
Maya Gosztyla

Reputation: 107

How to create a Venn diagram with a transparent background in R?

I'm using the package "VennDiagram" and used it to generate a nice plot. However I need to export it with a transparent background so that I can use it on a poster. Saving it as a .png directly didn't work, and neither did par(bg=NA). Any suggestions? I'm also willing to try a different package as my diagram is fairly simple.

Upvotes: 0

Views: 754

Answers (1)

Melissa Key
Melissa Key

Reputation: 4551

This worked for me: (from Export plot in .png with transparent background.)

library(gplots)
png("~/venn_test.png", bg = 'transparent')
venn(list(A = letters[sample(26, 10)],
       B = letters[sample(26, 10)],
       C = letters[sample(26, 10)]))
dev.off()

Upvotes: 1

Related Questions