Using this small dataset:
df <- structure(list(colour = structure(c(1L, 2L, 1L, 2L), .Label = c("Black", "White"), class = "factor"), variable = c("A", "A", "B", "B"), value = c(1, 2, 0.74, 0.85)), row.names = c(NA, -4L), .Names = c("colour", "variable", "value"), class = "data.frame")
I can easily create a vertical glass panel with ggvis
library(ggvis) df %>% ggvis(x=~variable, y=~value, fill=~colour) %>% group_by(colour) %>% layer_bars()

But I canโt understand how to have a horizontal stacked barplot. I think I should somehow use layer_rects , but the best thing I could get so far is just one group.
df %>% ggvis(x =~value, y=~variable, fill =~ colour) %>% group_by(colour) %>% layer_rects(x2 = 0, height = band())

source share