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