John Hunter wrote:
I welcome any comments/criticism to help improve this.
Hey Ryan,
I have looked at this code briefly and have a few minor comments. I
think Eric, who did the bulk of the current quiver implementation, and
as an oceanographer is in a field much closer to yours than mine, will
provide more useful feedback and should ultimately handle the patch
submission.
My first comment is that the code looks very good -- it is well
thought out and commented, and t is definitely suitable for inclusion
in the main line. Certainly the Barbs class can live in the
collections module. You note in the driver code that you are worried
about pollution of the axes namespace by including a domain specific
method, and this is a reasonable worry, but the axes namespace is
currently so polluted with plotting methods that it is a small worry.
I think it would be fine for you to rework your code into a patch
which provides the Barbs collection in matplotlib.collections, an Axes
method, and a pyplot interface function (with a pylab module level
docstring entry). The overloading of the Axes namespace is not ideal,
but it's what we've got.
Thanks. My question then is how do I add a pyplot interface, since it appears from the comments that many of those are just generated boilerplate?
My second comment has to do with your comment at the end of the example:
#Showing colormapping with uniform grid. Unfortunately, only the flags
#on barbs get colormapped this way.
On a cursory read of the code, it looks like you have implemented
everything as a single poly collection, and the reason the flags only
get colored is that the varicolored is black. It seems like there are
two solutions: write your class as a combination of poly collection
(for the flags) and line collection (for the barbs) and colormap both
(there are some line collection colormapping examples in the examples
subdir courtesy of Eric). The 2nd alternative, which I haven't
explored, is to set the edgecolor equal to the facecolor and support
colormapping of the edgecolors.
Yeah, the comment went more to explain expected results. There was no mystery to me why the edgecolors didn't get colormapped, it was pretty clear from the collections code. I had started down the road of combining lines and polygons in a PatchCollection, but that created a bunch of separate objects for each wind barb that had to each be transformed and have an offset applied. I took the lazy way out and created (admittedly) degenerate polygons.
I hadn't actually thought (call it a brain fart) about actually going ahead and adding colormapping for the edgecolors. Should I follow Mike's suggestion and possibly take a go at adding it to the general Collections class? (Granted, if someone else took a stab at it, it might land in SVN sooner, I'm sure I still have a learning curve to go here).
Overall this is very promising, and I wish you the best trying to make
mpl serviceble to the meteorology community. Jeff Whitaker has done a
phenomenal job with basemap providing extensions for those needing
cartographic projections as a toolkit. Depending on how far you want
to go with meteorological support, we can include the changes in the
mainline or fold them into a toolkit if they become hyper-specialized.
I still have a few more things to add (on top of what Whitaker already fixed for me):
* Need to plot something (empty circle) for vector magnitude < 5. (I did a plot the other day and was befuddled for a bit by seeing only 6 barbs)
* Need to fix support for masked arrays. The way the iteration goes right now, masked values end up being iterated over, which is bad.
* Probably should add a set_uv(c) method, like quiver
We'll see about the possibility of a toolkit. If I can keep up the momentum, I might end up with significant functionality. I'd also have to see how much of it really ends up being more than just simple example scripts. And I agree, huge props to Whitaker for Basemap. Hopefully I can get more people around me to use it instead of the abominations used now. 
(I'd have things sooner if it weren't for the stupid Google CodeJam
)
Ryan
···
On Tue, Jul 15, 2008 at 5:37 PM, Ryan May <rmay31@...149...> wrote:
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma