I am in process of migrating from Excel to ggvis for data analysis. For a typical grouped bar chart with two variables, however I have difficulty to plot bar chart side-by-side instead of stacked.
The following data has four steps A, B, C, D with "ratio" data from two features cc, ca. My attempt is to plot the ratio from cc and ca features side-by-side. However, the default plot with stack the two data together. Check the ggvis vignetts has an option to set stack =FALSE. But it would overlap the other feature.
Is there an option in ggvis to do things like "geom_bar(position="dodge")" in ggplot?
library(ggvis)
steps <-c("A","B","C","D","A","B","C","D")
ratio <-c(1.1,1.5,1.7,1.4,1.5,1.7,1.4,1.9)
feature <-c("cc","cc","cc","cc","ca","ca","ca","ca")
shrink <- data.frame(steps,ratio,feature)
shrink %>% ggvis(x= ~steps, y= ~ratio, fill = ~feature) %>% layer_bars()