Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2ac9d7b

Browse files
committed
BUG : make sure lw is a float
Explicitly cast linewidth to a float in `set_linewidth` methods of `Line2D` and `Patch` Closes #4306
1 parent 1b11d9d commit 2ac9d7b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/matplotlib/lines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ def set_linewidth(self, w):
919919
920920
ACCEPTS: float value in points
921921
"""
922-
self._linewidth = w
922+
self._linewidth = float(w)
923923

924924
def set_linestyle(self, linestyle):
925925
"""

lib/matplotlib/patches.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def set_linewidth(self, w):
334334
"""
335335
if w is None:
336336
w = mpl.rcParams['patch.linewidth']
337-
self._linewidth = w
337+
self._linewidth = float(w)
338338

339339
def set_lw(self, lw):
340340
"""alias for set_linewidth"""

0 commit comments

Comments
 (0)