From ee1c70bd99a9c8c0f0a28f9566db23047b0f1828 Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Fri, 18 Jul 2025 19:52:27 +0100 Subject: [PATCH] FIX: cast Patch linewidth to float for dash scaling --- lib/matplotlib/patches.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index 477eee9f5a7a..d750e86e401f 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -459,7 +459,8 @@ def set_linewidth(self, w): w : float or None """ w = mpl._val_or_rc(w, 'patch.linewidth') - self._linewidth = float(w) + w = float(w) + self._linewidth = w self._dash_pattern = mlines._scale_dashes(*self._unscaled_dash_pattern, w) self.stale = True