-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Arc patch ignoring theta1/theta2 when added to Axes via PatchCollection #11266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The problem is that the Possibly it's easier to find a sufficient workaround for this problem than to create a new |
@ImportanceOfBeingErnest Thanks for the quick response. I can certainly add the patches individually. I used a pattern in my code where I create a collection of elements and style them all at once via a but I can just as easily do this in a loop if that's the current preferred route. Not a big deal. That said, I wanted to let y'all know that a) this used to work, and b) I think the current behavior is surprising. If you need/want to keep it this way, you might want to update the docs. Thanks! |
I think it’s worth chasing down why it changed. |
You're right. My explanation comes short of explaining the issue. The code works as expected in matplotlib 2.0.2. Version 2.0.2 (released on 5 May 2017) contains the line: matplotlib/lib/matplotlib/patches.py Line 1561 in e175a41
This line was removed in #8047 (on 11 Mar 2017). Not sure how it can have been removed before the release but still be in it?! In any case, reintroducing this line into master will indeed produce arcs instead of ellipses in a PatchCollection; however the bug that #8047 fixed (or at least some other problem that produces wrong arc length) would be reintroduced into the code base. attn: @dstansby who removed this line in question and @tacaswell who confirmed that "pushing this down into Path.arc is not right". |
Does putting that line back in fix this problem, and pass all the tests? Might be worth trying. (sorry, I don't have time to look at this at the moment 😦 ) |
I did not run any tests, but as said, simply putting
|
To be more precise here, I'm considering the following code which should add an Arc between
Full code hereFull Code:
I'm running this code in several versions: Matplotlib 2.0.2
Matplotlib 2.2.2
Matplotlib development version + added matplotlib/lib/matplotlib/patches.py Line 1561 in e175a41
back into master produces:
|
I think we can just move the logic in the diff for #8047 into into the init rather than the draw. I can’t really think why this would have to be done at draw time, but maybe I’ve not thought it through. |
There are two reasons the arc is calculated at drawtime and not in the
I think it would be possible to sacrifice efficiency (1) and let the total arc be calculated at init; but I have no idea how to do that as long as it's not in an axes (2). I think this second point is what @dstansby stumbled upon when doing the fix, so I thought he might be able to tell a bit more on the reasoning here. |
Well, units + |
Is this bug fixed? |
No, it's unchanged. This is a fundamental design problem, which nobody has taken the effort to dive into and find a solution. |
Bug report
Bug summary
With matplotlib=2.1.2, when I add an
Arc
patch to anAxes
instance via aPatchCollection
, the arc always appear as a complete ellipse, regardless of values I set fortheta1
andtheta2
. When I add theArc
directly viaAxes.add_patch
, I don't have this problem.Last time I checked (matplotlib 1.4.0), this wasn't an issue. I haven't bisected to figure out when the problem started.
Code for reproduction
Actual outcome
Expected outcome
The arc in all three figures should be a 60deg arc, not a complete ellipse.
Matplotlib version
print(matplotlib.get_backend())
): module://ipykernel.pylab.backend_inlineI installed matplotlib via conda:
conda create -n py2 python=2 anaconda
The text was updated successfully, but these errors were encountered: