Skip to content

Commit dcd1d23

Browse files
drbergmantimhoffmQuLogic
authoredFeb 23, 2024
Fix Annulus width check (matplotlib#27811)
* Update patches.py Fix check on annulus width to reflect the error message printed. The logic is presented in this (slightly) convoluted form to better conform with the error message. Obviously, `if min(self.a, self.b) < width:` works just as well. This fix will allow annuli to be equivalent to Circles (in terms of area plotted, not underlying object structure). This means plotting (`_recompute_path`, I believe) could be improved by checking for `if w==a or w==b: PLOT WITHOUT HOLE`. Not sure how that would work, but everything does seem to work even without that change. * Update lib/matplotlib/patches.py We're in agreement on this. Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> * Update lib/matplotlib/patches.py Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com> --------- Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎lib/matplotlib/patches.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1840,9 +1840,9 @@ def set_width(self, width):
18401840
----------
18411841
width : float
18421842
"""
1843-
if min(self.a, self.b) <= width:
1843+
if width > min(self.a, self.b):
18441844
raise ValueError(
1845-
'Width of annulus must be less than or equal semi-minor axis')
1845+
'Width of annulus must be less than or equal to semi-minor axis')
18461846

18471847
self._width = width
18481848
self._path = None

0 commit comments

Comments
 (0)
Please sign in to comment.