You are passing certain rgb values, so matplotlib cannot create color code because it does not know how it relates to your source data.
Instead of displaying the values ββin RGB colors, let scatter handle this for you.
Instead:
do:
pts = plt.scatter(x_data, y_data, marker='s', c=data[x_data, y_data])
(Just go to c , from which you originally went to plt.cm.jet .)
Then you can normally create the color code. A specific error tells you that the colors were set manually and not set via set_array (which handles the mapping of data values ββto RGB).
Joe kington
source share