Skip to content
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

Add set/get for ellipse width/height #16395

Merged
merged 5 commits into from
Feb 7, 2020
Merged

Add set/get for ellipse width/height #16395

merged 5 commits into from
Feb 7, 2020

Conversation

LauLauThom
Copy link
Contributor

PR Summary

Add methods to set/get the width/height for Ellipse Patches.
Mostly the setter methods are interesting, as they set self.stale=True to force redrawing the patch at the next plot call.
I used those methods for interactive plotting, they have similar use than the existing set_center.
The stale=True was not be obvious to update the shape size interactively so I think the method could benefit others.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzer
Copy link
Contributor

anntzer commented Feb 4, 2020

Tests are failing.

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Overall, this looks good!

Please fix the style issues indicated by flake8:

./lib/matplotlib/patches.py:1453:1: D300 Use """triple double quotes"""
./lib/matplotlib/patches.py:1455:1: W293 blank line contains whitespace
./lib/matplotlib/patches.py:1462:1: W293 blank line contains whitespace
./lib/matplotlib/patches.py:1464:1: D300 Use """triple double quotes"""
./lib/matplotlib/patches.py:1468:1: W293 blank line contains whitespace
./lib/matplotlib/patches.py:1470:1: W293 blank line contains whitespace
./lib/matplotlib/patches.py:1472:1: D300 Use """triple double quotes"""
./lib/matplotlib/patches.py:1474:1: W293 blank line contains whitespace
./lib/matplotlib/patches.py:1481:1: W293 blank line contains whitespace
./lib/matplotlib/patches.py:1483:1: D300 Use """triple double quotes"""
./lib/matplotlib/patches.py:1487:1: W293 blank line contains whitespace
./lib/matplotlib/patches.py:1490:1: E302 expected 2 blank lines, found 1

@@ -1449,6 +1449,43 @@ def get_center(self):

center = property(get_center, set_center)

def set_width(self, width):
'''
Set the width of the ellipse
Copy link
Member

@timhoffm timhoffm Feb 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Set the width of the ellipse
Set the width of the ellipse.

Please finish the sentences with a period (following PEP-257) - also in the other methods. I know, there are some missing in the current docs, but we try to move towards a more consistent doc style.

@LauLauThom
Copy link
Contributor Author

Let me add the ellipse angle as well before merging the PR

@codecov
Copy link

codecov bot commented Feb 5, 2020

Codecov Report

Merging #16395 into master will decrease coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16395      +/-   ##
==========================================
- Coverage   80.85%   80.78%   -0.07%     
==========================================
  Files         307      307              
  Lines       75745    75767      +22     
  Branches     9690     9692       +2     
==========================================
- Hits        61245    61211      -34     
- Misses      11961    12012      +51     
- Partials     2539     2544       +5     
Impacted Files Coverage Δ
lib/matplotlib/backends/backend_macosx.py 4.39% <0.00%> (-36.27%) ⬇️
lib/matplotlib/backends/qt_compat.py 48.42% <0.00%> (-3.16%) ⬇️
lib/matplotlib/backends/backend_qt5.py 56.21% <0.00%> (-1.17%) ⬇️
lib/matplotlib/backends/backend_wx.py 49.11% <0.00%> (-0.84%) ⬇️
lib/matplotlib/font_manager.py 74.53% <0.00%> (-0.75%) ⬇️
lib/matplotlib/colors.py 88.22% <0.00%> (-0.13%) ⬇️
lib/matplotlib/cbook/__init__.py 76.76% <0.00%> (-0.12%) ⬇️
lib/matplotlib/spines.py 70.45% <0.00%> (-0.10%) ⬇️
lib/matplotlib/pyplot.py 72.86% <0.00%> (-0.04%) ⬇️
lib/matplotlib/ticker.py 77.98% <0.00%> (ø) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b47fc9d...1f0a5a1. Read the comment docs.

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commits should be squashed. (Either by OP, or as part of the merge via github by the second reviewer).

@dstansby dstansby added this to the v3.3.0 milestone Feb 7, 2020
@dstansby dstansby merged commit 182c2f2 into matplotlib:master Feb 7, 2020
@dstansby
Copy link
Member

dstansby commented Feb 7, 2020

Thanks for your first contribution to Matplotlib 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants