rbokeh icon indicating copy to clipboard operation
rbokeh copied to clipboard

feature request: grouped histgram / density plot

Open sinhrks opened this issue 10 years ago • 1 comments

Currently, there is no easy way to plot grouped histgram / density plot. Adding group kw to ly_hist and ly_density?

Currently, I do:

# to use mpg data
library(ggplot2)

colors <- scales::hue_pal()(length(levels(mpg$class)))
colors <- setNames(colors, levels(mpg$class))
colors
ghist <- function(fig, group) {
  ly_hist(fig, x = hwy, data = dplyr::filter(mpg, class == group),
          breaks = seq(10, 45, 5), color = colors[[group]])
}
Reduce(ghist, levels(mpg$class), figure())

07

sinhrks avatar Jul 25 '15 13:07 sinhrks

This should be a simple addition - will put it in soon.

hafen avatar Jul 27 '15 20:07 hafen