title: R Horizontal Stacked ggvis Barplot
body: <p>Using this small dataset:</p>
  
  <pre><code>df &lt;- 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")
  </code></pre>
  
  <p>I can easily create a vertical stacked barplot with <code>ggvis</code></p>
  
  <pre><code>library(ggvis)
  df %&gt;%
    ggvis(x=~variable, y=~value, fill=~colour) %&gt;%
    group_by(colour) %&gt;%
    layer_bars()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/hUK0C.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hUK0C.png" alt="enter image description here"></a></p>
  
  <p>But I cannot figure out how to have a horizontal stacked barplot.  I think I am somehow supposed to use <code>layer_rects</code> but the best I could get so far was just one group plotted.</p>
  
  <pre><code>df %&gt;%
    ggvis(x =~value, y=~variable, fill =~ colour) %&gt;%
    group_by(colour) %&gt;%
    layer_rects(x2 = 0, height = band())
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/5cIbW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5cIbW.png" alt="enter image description here"></a></p>