Custom pivot for barbs#5391
Conversation
|
A picture example? |
|
Rebased and added a test for the new pivot. |
|
It appears that your email address changed... Anyway, the test is failing either way. |
|
Great, a 2 pixel difference (the end of one of the barbs), at least on windows and Python 2.7. I just can't wait to figure this one out. |
This gives the user more control over where the barb pivots. The chief use case is to allow having the barb end offset from the center, to allow room for other plot elements.
|
Fixed the email. The test failure was two pixels at the end of one of the barbs, only on windows/linux. I tweaked the test to just hopefully avoid it. (I started digging in, but the point locations generated across the versions were identical, which means the difference was somewhere in the drawing code...) |
6b46cba to
da4fe92
Compare
|
Ok, everything is green! |
| entire barb should be rotated. Right now, valid options are | ||
| 'head' and 'middle'. | ||
| 'tip' and 'middle'. Can also be a number, which shifts the start | ||
| of the barb that many units from the origin. |
There was a problem hiding this comment.
But what "units" is it? Pixels?
There was a problem hiding this comment.
What units are polygons/paths/markers normally in? I don't think it's pixels, but it's not data coordinates either.
There was a problem hiding this comment.
I'd have thought points, but the scatter size is defined in points. I don't remember the scaling, but if it's a square, then the radius is √49/2 = 3.5. If it's actual circular area, it's √(49/π) = 3.949. But neither of these seem to match the shift defined in the test of 1.7, so I'm still not sure.
There was a problem hiding this comment.
It looks like the default pivot uses some factor of length and length is defined in points, so I guess this should be points.
BTW, in looking through this, I found a typo in the docs; do you mind fixing it here?
This section says the default length is 9, but the default appears to be 7.
Clarify units and make sure top-level barbs docstring reflects the new ability to pass a float for pivot.
|
Does that work for you @QuLogic ? |

This expands the
pivotkwarg to take a float value, allowing the user to manually specify where the barb should start. This allows, for instance, the barbs to be offset outward from the center plot, freeing the center for other plot elements.In meteorology, this is useful for standard plots where sky cover should be at the center, not the end of the wind barb.