1

I'm having difficulty styling this euler plot. One of my main issues is that I'd like the legend to be on the bottom, but display the variables horizontally. They look strange stacked vertically.

If anyone also knows how to adjust the margins, add a border around the whole plot, and add a subtitle, I'm stumped on those things too. I've already tried par(mar) and that didn't have any effect.

fit1 <- euler(c("Day 1" = 69, "Day 2" = 109, "Day 3" = 152,
                "Day 1&Day 2" = 11, "Day 1&Day 3" = 18, "Day 2&Day 3" = 28,
                "Day 1&Day 2&Day 3" = 2))

col <- c("#66D2D6", "#FBC740", "#E56997")

plot(fit1,
     quantities = TRUE,
     fills = list(fill = col, alpha = 0.8),
     edges = "black",
     main = list(label = "test", cex = 0.9),
     legend = list(side = "bottom"))

enter image description here

  • I haven't used `lattice` much, but try adding `columns = 3` to your legend list ... taking the idea from [this blog post](https://www.magesblog.com/post/2012-12-04-changing-colours-and-legends-in-lattice/) – Gregor Thomas Nov 30 '20 at 04:13
  • @GregorThomas: `euler` is in the `eulerr` package, not in `lattice`. – user2554330 Nov 30 '20 at 10:53

1 Answers1

2

The plot method for euler objects uses grid::grid.legend() to plot the legend. You can specify any of grid.legend's arguments in the legend argument to plot (which really calls plot.euler). To get a horizontal legend, use

plot(fit1,
     quantities = TRUE,
     fills = list(fill = col, alpha = 0.8),
     edges = "black",
     main = list(label = "test", cex = 0.9),
     legend = list(side = "bottom", nrow = 1, ncol = 3))
user2554330
  • 37,248
  • 4
  • 43
  • 90