79762901

Date: 2025-09-12 12:01:28
Score: 2
Natty:
Report link

ggMarginal has groupColour = TRUE and groupFill = TRUE which allows to take the groups from the initial ggplot.

library(ggplot2)
library(ggExtra)

p <- ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, color = Species)) +
  geom_point()

ggMarginal(p, type = "density", groupColour = TRUE, groupFill = TRUE)

enter image description here

Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Maxime Buron