I really like the eulerr package. It makes beautiful plots. I don't, however, have an eye for color, and would therefore like to use existing color schemes like "viridis" or "magma." Is this possible, or are these schemes restricted to continuous data?
Yes, it is possible
library(viridis)
library(eulerr)
Pull some viridis colors. I'm using the plasma scale (you can use magma, inferno, whatever scale you like) and pulling 4 colors because that's how many overlap areas there are in the demo plot further down.
colors <- c(viridis::plasma(n = 4))
Make a eulerr diagram, from eulerr demo here
fit1 <- euler(c("A" = 25, "B" = 5, "C" = 5,
"A&B" = 5, "A&C" = 5, "B&C" = 3,
"A&B&C" = 3))
set.seed(1)
mat <-
cbind(
A = sample(c(TRUE, TRUE, FALSE), size = 50, replace = TRUE),
B = sample(c(TRUE, FALSE), size = 50, replace = TRUE),
C = sample(c(TRUE, FALSE, FALSE, FALSE), size = 50, replace = TRUE)
)
fit2 <- euler(mat)
Plot the eulerr diagram with our viridis
colors
plot(fit2,
fills = list(fill = colors),
edges = list(lty = 1:3),
labels = list(font = 2))