Matthieu Brucher wrote:
> Hi,
> 
> I'm trying to display a scatter plot in 3D, and it calls the 2D scatter 
> plot, in axes.py. This method tests for validity of the color argument 
> in line 3777 :
> 
>         if not is_string_like(c) and iterable(c) and len(c)==len(x):
>             colors = None
>         else:
>             colors = ( colorConverter.to_rgba(c, alpha), )
> 
> The trick is that if c is a numpy array, it passes the test, and thus no 
> color is selected. If I get rid of the test and use a Nx3 array, the 
> plot is correctly displayed.
> 
> I suppose that we could make it :
> 
>         if not (is_string_like(c) or is_numlike(c)) and iterable(c) and 
> len(c)==len(x):
>             colors = None
>         else:
>             colors = ( colorConverter.to_rgba(c, alpha), )
> 
> ?

I don't quite understand: what kind of "c" are you passing in, what is 
the original code doing with it, and what should it do with it?  (I find 
both the original and the suggested code hard to understand, which makes 
me think that neither is actually what we want.)

I think that what we want may be the following:

try:
     colors = colorConverter.to_rgba_list(c, alpha)
except TypeError:
     colors = None  # generate colors later by applying a colormap to c

Part of what makes all this hard to understand is that in the None case, 
colors are generated from c far down in the code, out of sight of this 
initial processing.  Hence the comment.

OK, now I see that what I proposed won't work until I rip out the 
long-deprecated float-as-grey option.  Looks like a good time for me to 
do it.

Eric


> 
> I found a little error in a docstring, if this proposal is OK, I'll send 
> a diff patch to the list.
> 
> Matthieu
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to