diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 1830ef5309fe..7c1db6be21c0 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2057,9 +2057,9 @@ def _convert_dx(dx, x0, xconv, convert): dx = [convert(x0 + ddx) - x for ddx in dx] if delist: dx = dx[0] - except (TypeError, AttributeError) as e: - # but doesn't work for 'string' + float, so just - # see if the converter works on the float. + except (ValueError, TypeError, AttributeError): + # if the above fails (for any reason) just fallback to what + # we do by default and convert dx by iteslf. dx = convert(dx) return dx