1

As we know, if we want to give color to a point, we should do this.

import matplotlib.pyplot as plt
plt.plot(arrayOfX, arrayOfY, 'o', markersize=5, color = '0.0')

And I will get a picture with lots of black points.

What I want to do is I want every point with different color.

The syntax below is not correct, but can describe what I want to do:

plt.plot(arrayOfX, arrayOfY, 'o', markersize=5, color = color_list)

where the color_list contains every point's color.

Now I have an idea like this:

for i, color in enumerate(color_list):
    plt.plot(array(arrayOfX[i]), array(arrayOfY[i]), 'o', markersize=5, color = str(color))

which is extremely stupid but workable...

I might need a more elegant solution. Thank you all!

Mars Lee
  • 1,845
  • 5
  • 17
  • 37
  • 1
    See [this](https://stackoverflow.com/questions/17682216/scatter-plot-and-color-mapping-in-python) for an extensive answer on the topic. – Flomp Jul 05 '17 at 08:54
  • Use `scatter` with `Greys` color map or use `plot` in a cycle – Serenity Jul 05 '17 at 09:09

0 Answers0