1

I am plotting multiple series of scatter points and specifying the legend label in each scatter() function. The legend itself, however, is displayed in a random order. How can I display them in alphabetical (or other specified) order?

figure()
hold()

colors = ['#e41a1c', '#377eb8', '#4daf4a']

def myscatter(x, y, color, legend):
    scatter(x, y, color=color, legend=legend, fill_alpha=0.5, size=10)

myscatter(x1, y1, colors[0], 'x1')
myscatter(x2, y2, colors[1], 'x2')
myscatter(x3, y3 ,colors[2], 'x3')

show()

And here's a link to the image based on above code, where legend is displayed in random order: https://i.sstatic.net/pqXHj.jpg

1 Answer 1

1

Currently (as of 0.5.2) Bokeh does not track legend order. There is an open issue to track this behavior, and we hope to have it resolved soon!

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! That would explain why I couldn't find a solution. Wished I had the right brain power to solve the ticket... I look forward to a smart soul out there figuring it out.
This still is not fixed ... :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.