I have summary data for set intersections that I wish to visualize with R.
- Probability of A: 0.2
- Probability of B: 0.1
- Probability of A and B: 0.05
- Probability of A or B: 0.29
To visualize the data, I use the package {eulerr}
. See below. However, I wish to customize the appearance of the plot, but don’t know how to hack the object.
library(eulerr)
p1 <-
euler(c("A" = 0.205, "B" = 0.137, "A&B" = 0.0513)) |>
plot(quantities = TRUE,
fills = list(fill = c("lavenderblush2",
"lightblue2",
"lightsalmon")))
p2 <-
euler(c("A" = 0.205, "B" = 0.137, "A&B" = 0.0513)) |>
plot(quantities = FALSE,
fills = list(fill = c("#9195F6",
"#9195F6",
"#9195F6")))
p1
p2
Created on 2024-04-25 with reprex v2.0.2
I know that it’s a grid::grob
object because:
grid::is.grob(p1)
# [1] TRUE
How could I tweak some parts of the plot, for example:
-
change
p1
values from float to percents:
-
add labeling on top of
p2
: