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.