Re: [Matplotlib-users] Assign colors to list?

2011-09-26 Thread John Hunter
On Mon, Sep 26, 2011 at 12:05 PM, Katie Boyle katielbo...@gmail.com wrote:
 Hi All,

 I was wondering how I take a list of 250 discrete values and match up each
 value in the list to a color in the gist_rainbow colormap. I want the
 highest value to be red, and the lowest value to be blue. I then want to
 plot a point for each value in the list, and the point's color should
 represent its value. I cannot use contourf or any other function that does
 this automatically on a continuous grid--I need to plot individual points.

I think you are looking for scatter, with the c argument being
your intensity value.  You can pass the gist_rainbow colormap to the
scatter function via the cmap argument.  See these examples

http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_demo.html
http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_demo2.html

--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Assign colors to list?

2011-09-26 Thread John Hunter
On Mon, Sep 26, 2011 at 12:24 PM, John Hunter jdh2...@gmail.com wrote:
 On Mon, Sep 26, 2011 at 12:05 PM, Katie Boyle katielbo...@gmail.com wrote:
 Hi All,

 I was wondering how I take a list of 250 discrete values and match up each
 value in the list to a color in the gist_rainbow colormap. I want the
 highest value to be red, and the lowest value to be blue. I then want to
 plot a point for each value in the list, and the point's color should
 represent its value. I cannot use contourf or any other function that does
 this automatically on a continuous grid--I need to plot individual points.

 I think you are looking for scatter, with the c argument being
 your intensity value.  You can pass the gist_rainbow colormap to the
 scatter function via the cmap argument.  See these examples

 http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_demo.html
 http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_demo2.html

Eg,


In [43]: x, y, c = np.random.randn(3, 100)

In [44]: plt.scatter(x, y, c=c, cmap='gist_rainbow')
Out[44]: matplotlib.collections.PathCollection object at 0x981b22c

--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users