On Sat, Mar 14, 2009 at 12:22 PM, per freem <perfr...@gmail.com> wrote:

> hi all,
>
> i have a set of about 100-500 points that i'd like to color in different
> colors. i tried the following, using the c= argument to the scatter command:
>
> x = rand(200)
> scatter(x, x, c=xrange(1,201))
>
> however, only a handful of colors seem to be used and the points look very
> similar. what i am looking for is a different color for every point -- it
> can even be different shades, as in this example:
>
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_collection.html
>
> does anyone know how to create this?
>


The following works for me

  In [13]: x, y = np.random.rand(2, 100)

  In [14]: c = np.random.rand(100)

  In [15]: scatter(x, y, c=c)
  Out[15]: <matplotlib.collections.RegularPolyCollection object at
0x905e3ec>



> also, more complex, is there a way to do this where every point gets not
> only a different color but a different symbol? e.g. '^', 's', 'x', etc. ? i
> know there aren't 200 different symbols but it'd be nice if it cycled
> through the different symbols as much as possible (e.g. one point might be
> blue '^' and another might be red '^') to distinguish the points



This isn't supported with scatter -- you could make multiple calls to
scatter or plot if you want different symbols, but if you need *every*
symbol to be different this would be slow.  In that case, you might want to
write your own matplotlib.collections.PolygonCollection.

JDH
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to