Grouped AND Stacked Barplot

Hey @flachboard and @gcmicah

continuing from Stacked bar chart - specify color platte for a column couldn’t you just use subplots with sharedY = T. Something like:

grp <- c("A","B","C","D")
xval <- as.factor(c("x","y","x","y"))
frame <- merge(grp, xval, all=T)
yval <- as.factor(c('low', 'low-medium', 'medim-high', 'high'))
df <- tbl_df(cbind(frame, yval))
colnames(df) <- c("category", "Type", "Range")

p <- df %>% 
  group_by(category) %>% 
  arrange(Type) %>%
  plot_ly(
    x = ~Type, 
    y = ~Range, 
    color= ~category,
    colors = 'Reds',
    type = 'bar',
    legendgroup = "A")

pp <- df %>% 
  group_by(category) %>% 
  arrange(Type) %>%
  plot_ly(
    x = ~Type, 
    y = ~Range, 
    color= ~category,
    colors = 'Reds',
    type = 'bar',
    legendgroup = "A",
    showlegend=F)


subplot(p,pp,shareY = T) %>% layout(barmode = 'stack')