[matplotlib-devel] Scatter behavior for color field
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 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
Re: [matplotlib-devel] Scatter behavior for color field
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.) c is a named argument of the scatter method for the colors, but it is modified to get the real "colors" argument. 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 If you say so :) 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
Re: [matplotlib-devel] Scatter behavior for color field
This is done (with corresponding simplification of the code and improved error checking and reporting), and I have made slight changes to scatter, but there is still an ambiguity in scatter's argument handling. It was and is resolved in favor of treating the c argument as an array rather than an rgb or rgba sequence in any case where it could be either. (To be safe, if you want c to be an mpl color, use a string form of colorspec as specified in the scatter docstring.) I don't know whether this ambiguity, or possibly a bug in its resolution, was what prompted your original message. In any case, please try the svn version and see if it does what you want. If it does not, then please say exactly what c you are passing in to scatter, what scatter is doing, and what you think it should do instead. I never understood that from your previous messages. Eric Thanks for the update, I'll try it tuesday from work, but I don't think it will change anything. I'll post some pictures/data if you want. What I'm passing as argument for c is a numpy array of dimension (N, 3) with floats between 0 and 1. When I get rid of the check at line 3777, I can have a good scatter plot with the correct colors. This is why I proposed to check that the argument was string like or num like, because my argument for c is not string-like. One question that may arise is why do I use such colors and not mpl colors. The doc says that I can have color given by a tuple. In fact, the code can handle color in an array, and as the colors for each point in the scatter plot is generated by the coordinates of the point, the colors are stored in a numpy array. I do not want to transform them into strings or tuples if the code can handle numpy arrays. And it is more simple to officially allow the use of such color array for an average user. I hope you understand my point a little better now :| 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
Re: [matplotlib-devel] Scatter behavior for color field
> Thanks for the update, I'll try it tuesday from work, but I don't think > it will change anything. I'll post some pictures/data if you want. > What I'm passing as argument for c is a numpy array of dimension (N, 3) > with floats between 0 and 1. When I get rid of the check at line 3777, I > can have a good scatter plot with the correct colors. OK, I thought that might be the case. The behavior you want was not actually supported by scatter--at least it was contrary to the docstring--but it is reasonable, so I have made changes that I think will do what you want. I also changed the docstring to reflect this. Eric Thanks a lot for the update, I appreciate the patience you had to understand what I wanted. 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
Re: [matplotlib-devel] plotting a series of 3D points and, picker=True and 3D
2008/1/29, Neil Crighton <[EMAIL PROTECTED]>: > > I think it would be a shame to lose the current matplotlib 3d plotting > functionality, even if it's not ideal. I've found it very useful for > plotting small sets of data, and much more straightforward to use than > Mayavi or other vtk-based 3d plotting packages. > > Having said that, I'm not volunteering to make the 3d modules work > with the new transforms :-/ > I second everything ;) Matthieu -- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] wx back-end bugs/issues
> > > > 2) Use: > > F.savefig(open(path, "w"), dpi=dpi) > This is exactly what matplotlib the *Agg backends do on the 0.91.x > maintenance branch and the trunk. Unfortunately, 0.91.2 (the latest > release) still has this bug. This may be reason enough to push out a > new maintenance release of 0.91.x, but I say that having done it before ;) This is a really stopper for me, I have to interact with my figures before saving them, and it is a really annoying behavior. Were should this patch be applied ? +1 for a new maintenance release. I was searching for an answer to this, I'm glad the error was known and the fix available, so thanks :) Matthieu -- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] wx back-end bugs/issues
This is not a problem, I compile new nersions of differnet paclages regularly. I'll checkout the branch, many thanks ! Matthieu 2008/5/7 Michael Droettboom <[EMAIL PROTECTED]>: > Unfortunately, the fix requires recompiling C code. If you're comfortable > doing that, the easiest thing is just to check out the svn branch here: > > http://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_91_maint > > But for those not doing that, I think a new release is in order, but I'm > not the one who normally makes those calls etc. > > Cheers, > Mike > > Matthieu Brucher wrote: > >> >> >>> 2) Use: >>> F.savefig(open(path, "w"), dpi=dpi) >>This is exactly what matplotlib the *Agg backends do on the 0.91.x >>maintenance branch and the trunk. Unfortunately, 0.91.2 (the latest >>release) still has this bug. This may be reason enough to push out a >>new maintenance release of 0.91.x, but I say that having done it >>before ;) >> >> >> This is a really stopper for me, I have to interact with my figures before >> saving them, and it is a really annoying behavior. >> Were should this patch be applied ? >> >> +1 for a new maintenance release. >> >> I was searching for an answer to this, I'm glad the error was known and >> the fix available, so thanks :) >> >> Matthieu >> -- >> French PhD student >> Website : http://matthieu-brucher.developpez.com/ >> Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 >> LinkedIn : http://www.linkedin.com/in/matthieubrucher >> >> >> - >> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't >> miss this year's exciting event. There's still time to save $100. Use >> priority code J8TL2D2. >> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone >> >> >> ___ >> Matplotlib-devel mailing list >> Matplotlib-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >> >> > > -- > Michael Droettboom > Science Software Branch > Operations and Engineering Division > Space Telescope Science Institute > Operated by AURA for NASA > > -- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel