Revisiting the Grouped bar sorting inconsistency (legend vs label)

Hi All

This is an issue that has been brought up before:

and it looks like some efforts were made to help the users understand how bokeh processes the data:

While the new tutorials are useful in helping users prepare the data (ie, specifying the order of sort), but not exactly how to actually control the sorting behaviors of bokeh per se.

In the enclosed example:

  1. the legends shows order of the day as humans expect

  2. the labels are however, sorted in a different way…

It’s straight forward to sort [‘Monday’, ‘Tuesday’, … ‘Sunday’] with an external index or dictionary, but it’s not clear to me how I can tell bokeh to arrange the groups as shown in the legend. Since the legend is done correctly, how do I inform bokeh to sort the group exactly the same way?

bar_grp = Bar(df2,




group=cat(columns=[‘Day’], sort=False),

title=“Car Break-in by Time Groups and Day of Week”,

plot_width = 900, plot_height=600,


tooltips=[('Day: ', ‘@Day’)],

color=color(columns=[‘Day’], sort=False, palette=Spectral10)




What is the default sort logic for the label?

As an experiment, I created a separate integer column for each day string and sorted the DF against that column, hoping that it would make it easier for bokeh to maintain the sorting order. But that didn’t work either.

Any advice on how to proceed?

Thanks for your help.


ps. using bokeh 0.11

df2.csv (96.3 KB)