John [H2O] wrote:
> Hello,
> 
> I'm trying to plot text objects with the color used in m.scatter. My goal is
> to individually label each scatter object. I've tried the following:
> 
> circles=m.scatter(cx,cy,zsize,zlevel,cmap=cmap)
> 
> and then:
> CC = circles.get_facecolor()
> i=0
> for x,y in map(cx,cy):
>     ax.text(x,y,'some text', color=CC[i])
> 
> But if fails because:
> 
> m.scatter returns:
> <matplotlib.collections.CircleCollection object at 0x127898d0>
> 
> Rather than a list of objects??? Or something. The point is, I would expect
> 'circles' above to have len==cx, but it does not. What am I doing wrong?

The first thing you are doing wrong is failing to provide a complete, 
minimal, self-contained example illustrating the problem.  I don't think 
the snippet you gave is representative of what you are running.  Instead 
of "map" I think you mean "zip".  Where are you incrementing "i"?

The general approach of using the get_facecolor() method to get the 
array, and indexing into it, is fine.  That is not where the problem is. 
  Once you put together a minimal example, I think you will find the 
problem--or that there really is no problem.

A collection is used by scatter because it is much more efficient than a 
sequence of objects.

Eric

> 
> 
> 


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to