library(cssgrid)
library(ggplot2)
library(dplyr, warn.conflicts = FALSE)
library(purrr)
library(plotly, warn.conflicts = FALSE)
plots <- diamonds %>%
group_split(clarity) %>%
map(~ {
ggplot(.x) +
aes(price, fill = clarity) +
geom_density(show.legend = FALSE) +
scale_fill_discrete(drop = FALSE) +
labs(y = NULL) +
theme_minimal() +
facet_wrap(~ clarity)
}) %>%
map(plotly::ggplotly) %>%
map(plotly::layout, showlegend = FALSE) %>%
tagList