I am trying to make a discrete color panel for a scatter chart in matplotlib
I have data x, y and for each point the value of the integer tag that I want to represent with a unique color, for example
plt.scatter(x, y, c=tag)
Usually the tag will be an integer from 0 to 20, but the exact range may vary
So far, I just used the default settings, for example
plt.colorbar()
which gives a continuous range of colors. Ideally, I would like to have a set of n discrete colors (n = 20 in this example). Even better would be to get a tag value of 0 to create a gray color and 1-20 to be colorful.
I found several cookbook scenarios, but they are very complex, and I cannot think that they are the right way to solve a seemingly simple problem.
python matplotlib
bph Feb 08 '13 at 16:29 2013-02-08 16:29
source share