From 28ab92ef7915b14eb80be52c8254b02b1a5d9083 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Fri, 12 Apr 2024 10:35:39 +0200 Subject: [PATCH] Backport PR #28056: Strip trailing spaces from log-formatter cursor output. --- lib/matplotlib/tests/test_ticker.py | 10 +++++----- lib/matplotlib/ticker.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/tests/test_ticker.py b/lib/matplotlib/tests/test_ticker.py index 565f32105cea..36b83c95b3d3 100644 --- a/lib/matplotlib/tests/test_ticker.py +++ b/lib/matplotlib/tests/test_ticker.py @@ -1177,11 +1177,11 @@ def test_pprint(self, value, domain, expected): assert label == expected @pytest.mark.parametrize('value, long, short', [ - (0.0, "0", "0 "), - (0, "0", "0 "), - (-1.0, "-10^0", "-1 "), - (2e-10, "2x10^-10", "2e-10 "), - (1e10, "10^10", "1e+10 "), + (0.0, "0", "0"), + (0, "0", "0"), + (-1.0, "-10^0", "-1"), + (2e-10, "2x10^-10", "2e-10"), + (1e10, "10^10", "1e+10"), ]) def test_format_data(self, value, long, short): fig, ax = plt.subplots() diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 16949204a218..f042372a7be9 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -1024,7 +1024,7 @@ def format_data(self, value): def format_data_short(self, value): # docstring inherited - return '%-12g' % value + return ('%-12g' % value).rstrip() def _pprint_val(self, x, d): # If the number is not too big and it's an int, format it as an int.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: