I'm working on a shiny app to let students explore the basic probability equations and notation with dynamic Euler (Venn) diagrams responding to changes in probability and displaying the intersection of two sets, the union, the union of one set with the inverse of the other and so on.
So far I find that I can get the closest with eulerr, but I'm hoping to be able to change the background color or otherwise find a way to illustrate sets that include the "background", e.g. the inverse of (A ⋃ B). I could have white represent the selected set for those diagrams, but I'd prefer to be consistent.
I tried using par(bg = 'blue')
, but that doesn't appear to have an effect with plot in eulerr, and there doesn't seem to be anything in the documentation.
Am I missing some workaround or parameter, or is this just not possible?
I'd also be happy to use a different package.
Example illustrating A⋂B:
library("eulerr")
fit <- euler(c("A" = 10, "B" = 5, "A&B" = 3))
plot(fit, fills = c(FALSE, FALSE, TRUE), labels = list(col = "red", font = 4))
Example that would illustrate the inverse of B, if the background color change worked.
fit <- euler(c("A" = 10, "B" = 5, "A&B" = 3))
par(bg = 'blue')
plot(fit,
fills = c("blue", "white", "white"),
labels = list(col = "black", font = 4))
As the output is a grid object, I'd explore grid library, see example:
Or output as png, as it has background argument, here I am setting background to red to illustrate:
Both solutions would output below image: