| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| ax.plot([1, 2, 3]) | ||
|
|
||
|
|
||
| @image_comparison(baseline_images=['arc_angles']) |
There was a problem hiding this comment.
add remove_text=True and style='default' to the decorator to get the new defaults + drop all of the text (which makes the test more stable).
Sorry, something went wrong.
|
This will need an entry in whats new or api changes. The paranoid case here is that users have worked around this bug and we are now silently changing things under them so it needs to be documented. |
Sorry, something went wrong.
|
This looks like the correct place to do this to me. Ellipse is implemented by holding transforms to re-scale a circular path so pushing this down into Path.arc is not right and Ellipse is for full coverage so pushing this into the base-class is not right either. |
Sorry, something went wrong.
|
Does anyone know why the documentation build is failing with: /Users/dstansby/matplotlib/doc/examples/units/ellipse_with_units.rst:8: WARNING: Exception occurred in plotting ellipse_with_units
from /Users/dstansby/matplotlib/doc/mpl_examples/units/ellipse_with_units.py:
Traceback (most recent call last):
File "/Users/dstansby/matplotlib/lib/matplotlib/sphinxext/plot_directive.py", line 525, in run_code
six.exec_(code, ns)
File "<string>", line 55, in <module>
File "/Users/dstansby/matplotlib/lib/matplotlib/patches.py", line 1565, in __init__
theta1 = theta_stretch(theta1, width / height)
TypeError: unsupported operand type(s) for /: 'TaggedValue' and 'TaggedValue'
|
Sorry, something went wrong.
|
As far as I understand, it seems like “width” and “height” are cm instances from this script and that the class used under the hood (TaggedValue) does not implement the division operation. |
Sorry, something went wrong.
|
Would anyone object to me just getting rid of http://matplotlib.org/examples/units/ellipse_with_units.html ? It doesn't seem to be showing any unique capabilities of units, and the 'comparison' just looks the same to me. (and does it matter if my new code breaks drawing an ellipse with units?) |
Sorry, something went wrong.
|
Yes and yes (although, it seems like the problem here is the exact unit implementation, not generally). The unit support is an under-understood, but critical feature of mpl (JPL relies on it). |
Sorry, something went wrong.
|
As far as I can tell:
so all this means there's no way of converting units within the __init__ bit of Arc, so the conversion and angle correction needs to happen somewhere else. |
Sorry, something went wrong.
|
That should fix it, I've moved the new calculation into the draw() method. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM mostly. Just a small tweak to the test.
Sorry, something went wrong.
| theta2 = i * 360 / 9 | ||
| theta1 = theta2 - 45 | ||
| ax.add_patch(patches.Arc(centre, w, h, theta1=theta1, theta2=theta2)) | ||
| # Straight line should intersect end of arc |
There was a problem hiding this comment.
Could you also add the start of the arc as well? Start -> origin -> end should work.
Sorry, something went wrong.
| centre = (0.2, 0.5) | ||
|
|
||
| fig, axs = plt.subplots(3, 3) | ||
| for i, ax in enumerate(np.ravel(axs)): |
There was a problem hiding this comment.
enumerate(axs.flat)
Sorry, something went wrong.
| for i, ax in enumerate(np.ravel(axs)): | ||
| theta2 = i * 360 / 9 | ||
| theta1 = theta2 - 45 | ||
| ax.add_patch(patches.Arc(centre, w, h, theta1=theta1, theta2=theta2)) |
There was a problem hiding this comment.
Can you also add a full Ellipse patch with the same parameters but maybe half linewidth or alpha just to show that the arc is in a consistent place?
Sorry, something went wrong.
|
Thanks for the extra ideas for the test @QuLogic - once this has been reviewed I can squash everything down to a single commit. |
Sorry, something went wrong.
|
Is there anything backend-specific here? Do we need the SVG/PDF files? |
Sorry, something went wrong.
|
Oh yes, I forgot that those were optional. I don't think there's anything backend specific, shall I just have a .png image test? |
Sorry, something went wrong.
|
Yes, I think we can drop the other ones and you can squash this. |
Sorry, something went wrong.
Make arcs work with units Add api change not for elliptical notes Add background ellipse and extra line to test Remove pdf and svg tests for arc angles
|
Great, that should be all nicely squashed up now. |
Sorry, something went wrong.
There was a problem hiding this comment.
One more minor thing.
Sorry, something went wrong.
| The `matplotlib.patches.Arc` patch is now correctly drawn between the given | ||
| angles. | ||
|
|
||
| Previously a circular are was drawn and then stretched into an ellipse, |
There was a problem hiding this comment.
are -> arc
Sorry, something went wrong.
There was a problem hiding this comment.
woops...
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #8046. I'm not sure if this is the right place to do the correction, so a second opinion would be good. I've checked this works with a full range of angles.