Ryan May wrote:
> On Mon, Nov 10, 2008 at 5:54 PM, Eric Firing <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
>     Ryan May wrote:
> 
>         Ok, here's a patch that fixes the problem for me, as well as a test
>         script that tests a bunch of the color options along with having
>         more,
>         the same, and less than the number of points passed in.
> 
>         This is triggered by passing in a sequence of strings of the
>         same length
>         as x, which matplotlib interprets as needing colormapping.
>          Colormapping
>         an array of strings explodes nicely.  I've fixed this issue by:
> 
>         1) Make scatter() check if c is a sequence of strings.  If it
>         is, use
>         the colorConverter as expected.
> 
>         2) This requires changing is_string_like() to recognize elements
>         from
>         numpy string arrays (type numpy.string_) as strings.  These
>         elements are
>         actually instances of a subclass of python strings
>         (isinstance(<element>, str is True), but fail because they have
>         a shape
>         attribute (which is explicitly checked).
> 
>         3) Changing colorConverter.to_rgba_array() to accept a 1D numpy
>         array
>         containing strings.  Currently, there is an explicit check for a 2D
>         array, and if it is not, and exception is thrown.
> 
>         Since this is my first mucking around in internals with which I
>         am not
>         familiar, I'd like someone to double check me.  It's only a 3
>         line diff,
>         but each line is in a different file, so it's got a pretty wide
>         (though
>         thin) footprint.
> 
> 
>     Ryan,
> 
>     Here is a modification of your patch that I think will be very
>     slightly more efficient and general.
> 
> 
> Thanks.  That does look a lot more clean.  It would have helped if I had 
> known about dtype.kind for ease of testing for arrays of strings and 
> numpy string scalars.
> 
> Anyone else?

Ryan,

I hope you don't mind--I took care of the "FIXME" that I had put in, and 
committed the whole thing.  Your test passes, and the backend_driver.py 
seems happy, so it should be OK.

Eric

> 
> Ryan
> 
> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to