From 8d3dfce63739a9a3481854ba9dbc1b9019fe3f35 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Thu, 11 Apr 2024 10:49:50 +0200 Subject: [PATCH] Strip trailing spaces from log-formatter cursor output. The trailing spaces were fine when the cursor position was shown as `x=... y=...`, but become very ugly now that it's `(x, y) = (..., ...)`. --- 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. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy