Search code examples
rshinyshinydashboard

How can I change the background color of venn diagram using draw.pairwise.venn in R?


draw.pairwise.venn returns an image object, hence can't wrap it with CSS. Is there any way I can change background color of venn diagram.

library(VennDiagram)

renderPlot(draw.pairwise.venn(32+134,24+134,134,category = c("A","B"),
                                      ext.text = TRUE,lty = "blank",fill = c("yellow","green"),scaled = FALSE,
                                      ext.pos = 0,cat.pos = 0, cat.dist = 0.06))

I am trying to match my plot with the color of my shiny dashboard.


Solution

  • As suggested by @krfurlong ggvenn package can be used to plot Venn diagrams, and customize your plot according to requirements with the help of ggplot2.

    you can install ggvenn by:

    if (!require(devtools)) install.packages("devtools")
    devtools::install_github("yanlinlin82/ggvenn")