Color gradient on scatter plot based on values
<p>I would like to define a color gradient for this image:
<a href="http://i.stack.imgur.com/xjtq5.png" rel="nofollow"><img src="http://i.stack.imgur.com/xjtq5.png" alt="enter image description here"></a></p>

<p>For each direction, I want to define a color gradient from red to blue depending on the density of values or the distance of points with the mode.</p>

<p>First, for each data point compute the desired color. The provide the color specification sequence as <code>c</code> parameter of the <code>scatter</code> function (<a href="http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.scatter" rel="nofollow">http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.scatter</a>). Colormaps (like those here: <a href="http://matplotlib.org/examples/color/colormaps_reference.html" rel="nofollow">http://matplotlib.org/examples/color/colormaps_reference.html</a>) may help with the first step.</p>

<p>Also, if your color is meant to represent density, you should consider finding the right probability distribution (such as the gaussian one) for the data in given direction and base the coloring on it.</p>

python matplotlib scatter-plot