When I create a legend in R-leaflet, I can hijack the color attribute to add extra flair besides just actual fill color. It seems that the color attribute is mostly a css declaration and I can augment that with additional css as long as the syntax works. For example, I have a map feature that has cross-hatching using the Hatched.Polygons package, and I added a background: repeating-linear-gradient string into the color field and thus drew a legend box with lines across it to signify those items on the map.
Is it at all possible to something similar with the VennDiagram package? My venn diagram represents things on the map, so it would be helpful visually if I could have the circle for the hatched items to also be hatched. I tried the same thing with passing additional css into the fill vector, but it failed.
Is what I'm trying to do possible?
library(shiny)
library(VennDiagram)
ui <- fluidPage(
plotOutput("venn")
)
server <- function(input, output, session ) {
set.seed(20190708)
genes <- paste("gene",1:1000,sep="")
x <- list(
A = sample(genes,300),
B = sample(genes,525),
C = sample(genes,440)
)
display_venn <- function( x , .... ) {
library(VennDiagram)
grid.newpage()
venn_object <- venn.diagram(
x,
filename=NULL,
fill = c("red","blue","green") # can I put something other than merely a color here?
)
grid.draw(venn_object)
}
output$venn <- renderPlot({
display_venn(x)
})
}
shinyApp(ui = ui, server = server)
I can do this in leaflet:
addLegend(
colors = c(
"red",
"blue",
"green"
)
)
or I can do:
addLegend(
colors = c(
"red",
"blue",
"green; background:repeating-linear-gradient(45deg,rgba(255,255,255,0.7),rgba(255,255,255,0.7) 4px,rgba(0,0,0,1) 4px , rgba(0,0,0,1) 5px "
)
)
essentially hijacking the css. Are there any options to mimicking this in a venn diagram?