I’ve been fighting with this occasionally, and haven’t gotten it to work. I want to make a simple grouped bar chart out of a simple DataFrame, but no example I’ve seen that just quickly gets to the point.
Suppose it’s a simple one, having a few columns like Year, AmountOfPeople and AmountOfPeopleCasualty. You want to simply plot a bar chart where x has the year, and y has both the amount of people and the amount of casualties (out of these people), where these two columns are immediately next to each other per year.
I just yesterday merged a lot of new support for Vega specs! All of this is only available on VegaLite#master. In particular, there is now a @vgplot macro that works the same way as the @vlplot macro, just for Vega specs.The main benefit is that one doesn’t need to use these literal JSON strings anymore. The documentation for that new macro is here.The grouped bar chart example looks like this with the new syntax. The example is a little less nice than what @oheil posted because it has the data inline, instead of using a DataFrame. Would probably make sense to update the example in the docs to also use a DataFrame (this section in the docs exaplains how one passes external data to the @vgplot macro).
Oh, and one more small thing: try stack(df, Not(:Year), variable_name=:AmountOf, value_name=:Amount) for the DataFrame reshaping stuff