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)