I want to color each segment of a Venn diagram with four conditions according to color scale (see below). However, the colors do not map to the correct sections and are way off from what I want. How can I fix this?
library(ggVennDiagram)
library(ggplot2)
genes <- paste0("gene",1:40)
gene_list <- list(
A = genes[1:10],
B = genes[1:20],
C = genes[5:15],
D = genes[30:40]
)
colorGroups <- c(A = "#45B6AA", B = "#D45176", C = "#91A6CE", D = "#86AD4C")
# use colorRampPalette to create function that interpolates colors
colfunc <- colorRampPalette(colorGroups)
# call function and create vector of 15 colors
col <- colfunc(15)
ggvenn::ggvenn(data = gene_list,
fill_alpha = 0.5,
fill_color = col,
show_percentage = FALSE)
The colorRampPalette works as expected, however the colors are not mapped correctly. For example, section C is grey (default), but it should actually be green.
c("#45B6AA", "#63A09E", "#828A93", "#A07588")
. Why not usingfill_color = colorGroups
?