-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Arcs with large radii in small #17547
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 issue is with the comparison on Line L1669 of patches.py:
For this case I'm getting:
I've disabled the check and it does render correctly: |
This bisects to #8047 (2.1). So it should be fixed but I'm not sure it's release critical. |
The I also just got to this bisecting to a 2.1 change so it is not a recent regression, but it should still be fixed ASAP as this is a rather terrible bug. |
The fix seems to be pretty simple, we need to not do the stretching when going through the accurate path. |
The draw method of mpatches.Arc has two paths: - if the arc is "small" compared to its size in the rendered image then render the whole arc and let clipping do it's thing - if the arc is "big" compared to its size on the screen then sort out where the circle intersects the axes boundary and only draw that part of it This makes several changes to the Arc draw method: - only "squash" the angles in the "small" case is we handle it in the "big" case via transforms - make sure that we don't re-order the angles while "squashing" them. Adjusted the test image to use this failing case and to exercise both code paths. closes matplotlib#17547
The draw method of mpatches.Arc has two paths: - if the arc is "small" compared to its size in the rendered image then render the whole arc and let clipping do it's thing - if the arc is "big" compared to its size on the screen then sort out where the circle intersects the axes boundary and only draw that part of it This makes several changes to the Arc draw method: - only "squash" the angles in the "small" case is we handle it in the "big" case via transforms - make sure that we don't re-order the angles while "squashing" them. - the computed height / width is offset in pixels of the center of the arc from the lower left of the figure. We do not care about the sign, only that it is "far away" or not. Adjusted the test image to use this failing case and to exercise both code paths. closes matplotlib#17547
The draw method of mpatches.Arc has two paths: - if the arc is "small" compared to its size in the rendered image then render the whole arc and let clipping do it's thing - if the arc is "big" compared to its size on the screen then sort out where the circle intersects the axes boundary and only draw that part of it This makes several changes to the Arc draw method: - only "squash" the angles in the "small" case is we handle it in the "big" case via transforms - make sure that we don't re-order the angles while "squashing" them. - the computed height / width is offset in pixels of the center of the arc from the lower left of the figure. We do not care about the sign, only that it is "far away" or not. Adjusted the test image to use this failing case and to exercise both code paths. closes matplotlib#17547
The draw method of mpatches.Arc has two paths: - if the arc is "small" compared to its size in the rendered image then render the whole arc and let clipping do it's thing - if the arc is "big" compared to its size on the screen then sort out where the circle intersects the axes boundary and only draw that part of it This makes several changes to the Arc draw method: - make sure that we don't re-order the angles while "squashing" them. - the computed height / width is offset in pixels of the center of the arc from the lower left of the figure. We do not care about the sign, only that it is "far away" or not. Adjusted the test image to use this failing case and to exercise both code paths. closes matplotlib#17547
The draw method of mpatches.Arc has two paths: - if the arc is "small" compared to its size in the rendered image then render the whole arc and let clipping do it's thing - if the arc is "big" compared to its size on the screen then sort out where the circle intersects the axes boundary and only draw that part of it This makes several changes to the Arc draw method: - the computed height / width is offset in pixels of the center of the arc from the lower left of the figure. We do not care about the sign, only that it is "far away" or not. - make sure that we keep angles in [0, 360) range Tests: - Adjusted an existing test image to use this failing case and to exercise both code paths. - Added a test function of "low resolution" angles, Should draw the arc from the red to blue lines in the counter-clockwise direction. closes matplotlib#17547
The draw method of mpatches.Arc has two paths: - if the arc is "small" compared to its size in the rendered image then render the whole arc and let clipping do it's thing - if the arc is "big" compared to its size on the screen then sort out where the circle intersects the axes boundary and only draw that part of it This makes several changes to the Arc draw method: - make sure that we keep angles in [0, 360) range - only go through the angle stretching code if we need to (to avoid numerical instability of angles not round-tripping with scale=1) Tests: - Adjusted an existing test image to use this failing case and to exercise both code paths. - Added a test function of ensuring we can draw a big arc in each quadrant closes matplotlib#17547
The draw method of mpatches.Arc has two paths: - if the arc is "small" compared to its size in the rendered image then render the whole arc and let clipping do it's thing - if the arc is "big" compared to its size on the screen then sort out where the circle intersects the axes boundary and only draw that part of it This makes several changes to the Arc draw method: - make sure that we keep angles in [0, 360) range - only go through the angle stretching code if we need to (to avoid numerical instability of angles not round-tripping with scale=1) Tests: - Adjusted an existing test image to use this failing case and to exercise both code paths. - Added a test function of ensuring we can draw a big arc in each quadrant closes matplotlib#17547
The draw method of mpatches.Arc has two paths: - if the arc is "small" compared to its size in the rendered image then render the whole arc and let clipping do it's thing - if the arc is "big" compared to its size on the screen then sort out where the circle intersects the axes boundary and only draw that part of it This makes several changes to the Arc draw method: - make sure that we keep angles in [0, 360) range - only go through the angle stretching code if we need to (to avoid numerical instability of angles not round-tripping with scale=1) Tests: - Adjusted an existing test image to use this failing case and to exercise both code paths. - Added a test function of ensuring we can draw a big arc in each quadrant closes matplotlib#17547
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug summary
No
matplotlib.patches.Arc
is being rendering when trying to add a small segment of a circle with a large radius.If I increase the x and y limits to include a larger section of the arc then it is rendered.
Code for reproduction
Actual outcome
An empty figure:
Expected outcome
A figure with a small section of an arc starting a$(0, 5)$ and ending at $(7.98894818241678, 10.0)$

Matplotlib version
print(matplotlib.get_backend())
): module://ipykernel.pylab.backend_inlineThe text was updated successfully, but these errors were encountered: