☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Sorting an alphabetical axis

Community Support
Reuben_Jacobs
Reuben_Jacobs

Hi,

Does anyone know how to sort an axis (y in my case) for a chart (heatmap in my case) when the values on the axis are not numbers. In my example, the y-values are words and I want them to be sorted alphabetically.

Thanks,

Reuben

⌁   Link to post
adrianmck1
adrianmck1

Hi Reuben,

in the example below, I’m using a pandas dataframe called “dsource” which has been sorted by the x variable and I am then getting those values into a list, sorting the list and setting the x_range of the Bokeh figure.

factors = set(dsource[xVarname].values)

factors = list(factors)

factors.sort()

f = figure(x_range=factors)

``

Hopefully that will help you out.

Regards,

Adrian.

⌁   Link to post
Reuben_Jacobs
Reuben_Jacobs

Adrian,

I will give this a go. Thanks.

Reuben

···

On Thursday, March 23, 2017 at 1:19:39 PM UTC-4, adria...@gmail.com wrote:

Hi Reuben,

in the example below, I’m using a pandas dataframe called “dsource” which has been sorted by the x variable and I am then getting those values into a list, sorting the list and setting the x_range of the Bokeh figure.

factors = set(dsource[xVarname].values)

factors = list(factors)

factors.sort()

f = figure(x_range=factors)

``

Hopefully that will help you out.

Regards,

Adrian.

⌁   Link to post

End of archived discussion · Replies are disabled