Reputation: 429
Is it possible to create a plot in bokeh that is both stacked and grouped? Kinda like http://www.highcharts.com/demo/column-stacked-and-grouped/.
The dataset is something like this
count date class user
39 2016/12/28 4 user1
26 2016/12/28 4 user2
3 2016/12/28 4 user2
8 2016/12/28 4 user1
1 2016/12/28 4 user1
22 2016/12/28 4 user1
26 2016/12/28 4 user2
1 2016/12/28 4 user1
7 2016/12/28 4 user2
12 2016/12/28 4 user3
23 2016/12/28 4 user3
31 2016/12/28 4 user3
2 2016/12/31 4 user1
1 2016/12/31 4 user2
27 2016/12/31 4 user2
What I want to do is visualize the counts by stacking across class and grouping across user with the label for x-axis being the dates.
Upvotes: 4
Views: 3012
Reputation: 156
I know I'm late, but the example under stacking and grouping in the following article from the official bokeh documentation covers this:
https://docs.bokeh.org/en/latest/docs/user_guide/categorical.html
Upvotes: 0
Reputation: 1316
Yes you can. Assuming you have your data in a pandas dataframe (df).
Here is an example in the bokeh documentation: Grouping Bar plots
from bokeh.charts import Bar, output_file, show
p = Bar(df, label='date', values='count', stack='class', group='user',
)
output_file("bar.html")
show(p)
Upvotes: 4