Empty wind barb suggestion

Hi,

In trying to add a symbol for an empty wind barb, I ran into problem. Traditionally, a smaller, non-filled circle is used for low wind speeds when doing a barb plot. I can draw the circle easily as a polygon, using CirclePolygon from patches, but unfortunately, the fill color for this polygon ends up being the same as the color of the flags on the barbs. Therefore, as currently implemented, the only way to have unfilled circles is to have unfilled flags.

The only technical solution I can think of here is to have separate collections for the circles and the polygons. Unfortunately, I have no idea how to begin to do that within a class that inherits from collections. Another option would be to somehow manually set the fill colors on the circles after the collection is initialized. Anyone have suggestions on how to make this work, or maybe a better technical solution.

Jeff, how aesthetically displeasing do you think it would be to have small (possibly colored) circles to represent the low winds instead of the traditional (somewhat larger) hollow circle? It would make it impossible to do sky cover in a traditional surface map, but maybe Z-ordering could be used to hack around it.

Thoughts,

Ryan

···

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

Ryan May wrote:

Hi,

In trying to add a symbol for an empty wind barb, I ran into problem. Traditionally, a smaller, non-filled circle is used for low wind speeds when doing a barb plot. I can draw the circle easily as a polygon, using CirclePolygon from patches, but unfortunately, the fill color for this polygon ends up being the same as the color of the flags on the barbs. Therefore, as currently implemented, the only way to have unfilled circles is to have unfilled flags.

The only technical solution I can think of here is to have separate collections for the circles and the polygons. Unfortunately, I have no idea how to begin to do that within a class that inherits from collections. Another option would be to somehow manually set the fill colors on the circles after the collection is initialized. Anyone have suggestions on how to make this work, or maybe a better technical solution.

Ryan,

Yes, this would require some bigger changes. Instead of inheriting from PolyCollection, it would have to contain two collections, or a collection and a Line2D with markers.

An alternative would be to override the PolyCollection.draw() method with a near-copy, but with logic added right before the renderer call to set the alpha (column 3) of the rgba array to zero for the circles.

A better way might be to modify the original draw method to use self.get_facecolors() instead of self._facecolors; then one could override the get_facecolors method, which would require much less code.

Eric

···

Jeff, how aesthetically displeasing do you think it would be to have small (possibly colored) circles to represent the low winds instead of the traditional (somewhat larger) hollow circle? It would make it impossible to do sky cover in a traditional surface map, but maybe Z-ordering could be used to hack around it.

Thoughts,

Ryan

I don't know if this simplifies things (you're much deeper in the middle of doing what you need to do), but PolyCollection really is a path collection these days. (The name is really for historical reasons). And since paths can be compound, you could draw a hollow circle using an inner and an outer circle. See Path.unit_circle for a direct way to get a series of bezier curves to approximate a circle.

Of course, if you've found a simpler way in the mean time, go for it!

Cheers,
Mike

Eric Firing wrote:

···

Ryan May wrote:
  

Hi,

In trying to add a symbol for an empty wind barb, I ran into problem. Traditionally, a smaller, non-filled circle is used for low wind speeds when doing a barb plot. I can draw the circle easily as a polygon, using CirclePolygon from patches, but unfortunately, the fill color for this polygon ends up being the same as the color of the flags on the barbs. Therefore, as currently implemented, the only way to have unfilled circles is to have unfilled flags.

The only technical solution I can think of here is to have separate collections for the circles and the polygons. Unfortunately, I have no idea how to begin to do that within a class that inherits from collections. Another option would be to somehow manually set the fill colors on the circles after the collection is initialized. Anyone have suggestions on how to make this work, or maybe a better technical solution.
    
Ryan,

Yes, this would require some bigger changes. Instead of inheriting from PolyCollection, it would have to contain two collections, or a collection and a Line2D with markers.

An alternative would be to override the PolyCollection.draw() method with a near-copy, but with logic added right before the renderer call to set the alpha (column 3) of the rgba array to zero for the circles.

A better way might be to modify the original draw method to use self.get_facecolors() instead of self._facecolors; then one could override the get_facecolors method, which would require much less code.

Eric

Jeff, how aesthetically displeasing do you think it would be to have small (possibly colored) circles to represent the low winds instead of the traditional (somewhat larger) hollow circle? It would make it impossible to do sky cover in a traditional surface map, but maybe Z-ordering could be used to hack around it.

Thoughts,

Ryan

-------------------------------------------------------------------------
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