Sorting an alphabetical axis

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

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.

Adrian,

I will give this a go. Thanks.

Reuben

···

On Thursday, March 23, 2017 at 1:19:39 PM UTC-4, [email protected] 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.