From a420913064d222a7123f49a39d3c633d2f2aacb9 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Mon, 11 Jun 2018 10:38:29 -0700 Subject: [PATCH 1/2] FIX: better default spine path (for logit) --- lib/matplotlib/spines.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/spines.py b/lib/matplotlib/spines.py index a47c14a90073..7c0bcbc873f7 100644 --- a/lib/matplotlib/spines.py +++ b/lib/matplotlib/spines.py @@ -481,15 +481,15 @@ def linear_spine(cls, axes, spine_type, **kwargs): """ (staticmethod) Returns a linear :class:`Spine`. """ - # all values of 13 get replaced upon call to set_bounds() + # all values of 0.999 get replaced upon call to set_bounds() if spine_type == 'left': - path = mpath.Path([(0.0, 13), (0.0, 13)]) + path = mpath.Path([(0.0, 0.999), (0.0, 0.999)]) elif spine_type == 'right': - path = mpath.Path([(1.0, 13), (1.0, 13)]) + path = mpath.Path([(1.0, 0.999), (1.0, 0.999)]) elif spine_type == 'bottom': - path = mpath.Path([(13, 0.0), (13, 0.0)]) + path = mpath.Path([(0.999, 0.0), (0.999, 0.0)]) elif spine_type == 'top': - path = mpath.Path([(13, 1.0), (13, 1.0)]) + path = mpath.Path([(0.999, 1.0), (0.999, 1.0)]) else: raise ValueError('unable to make path for spine "%s"' % spine_type) result = cls(axes, spine_type, path, **kwargs) From e213f4bc48ab6e5e24519048d3515d20f484e5f1 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Tue, 12 Jun 2018 10:27:24 -0700 Subject: [PATCH 2/2] TST: add test for finite bbox on logit --- lib/matplotlib/tests/test_scale.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_scale.py b/lib/matplotlib/tests/test_scale.py index 07cebd56f7db..aeab44e026dd 100644 --- a/lib/matplotlib/tests/test_scale.py +++ b/lib/matplotlib/tests/test_scale.py @@ -17,7 +17,7 @@ def test_log_scales(): @image_comparison(baseline_images=['logit_scales'], remove_text=True, extensions=['png']) def test_logit_scales(): - ax = plt.figure().add_subplot(111, xscale='logit') + fig, ax = plt.subplots() # Typical extinction curve for logit x = np.array([0.001, 0.003, 0.01, 0.03, 0.1, 0.2, 0.3, 0.4, 0.5, @@ -25,7 +25,11 @@ def test_logit_scales(): y = 1.0 / x ax.plot(x, y) + ax.set_xscale('logit') ax.grid(True) + bbox = ax.get_tightbbox(fig.canvas.get_renderer()) + assert np.isfinite(bbox.x0) + assert np.isfinite(bbox.y0) def test_log_scatter():