Skip to content

Commit 928d6d5

Browse files
authored
Merge pull request #11417 from jklymak/fix-better-default-spine-path
FIX: better default spine path (for logit)
2 parents 7457eda + e213f4b commit 928d6d5

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

lib/matplotlib/spines.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,15 +481,15 @@ def linear_spine(cls, axes, spine_type, **kwargs):
481481
"""
482482
(staticmethod) Returns a linear :class:`Spine`.
483483
"""
484-
# all values of 13 get replaced upon call to set_bounds()
484+
# all values of 0.999 get replaced upon call to set_bounds()
485485
if spine_type == 'left':
486-
path = mpath.Path([(0.0, 13), (0.0, 13)])
486+
path = mpath.Path([(0.0, 0.999), (0.0, 0.999)])
487487
elif spine_type == 'right':
488-
path = mpath.Path([(1.0, 13), (1.0, 13)])
488+
path = mpath.Path([(1.0, 0.999), (1.0, 0.999)])
489489
elif spine_type == 'bottom':
490-
path = mpath.Path([(13, 0.0), (13, 0.0)])
490+
path = mpath.Path([(0.999, 0.0), (0.999, 0.0)])
491491
elif spine_type == 'top':
492-
path = mpath.Path([(13, 1.0), (13, 1.0)])
492+
path = mpath.Path([(0.999, 1.0), (0.999, 1.0)])
493493
else:
494494
raise ValueError('unable to make path for spine "%s"' % spine_type)
495495
result = cls(axes, spine_type, path, **kwargs)

lib/matplotlib/tests/test_scale.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@ def test_log_scales():
1717
@image_comparison(baseline_images=['logit_scales'], remove_text=True,
1818
extensions=['png'])
1919
def test_logit_scales():
20-
ax = plt.figure().add_subplot(111, xscale='logit')
20+
fig, ax = plt.subplots()
2121

2222
# Typical extinction curve for logit
2323
x = np.array([0.001, 0.003, 0.01, 0.03, 0.1, 0.2, 0.3, 0.4, 0.5,
2424
0.6, 0.7, 0.8, 0.9, 0.97, 0.99, 0.997, 0.999])
2525
y = 1.0 / x
2626

2727
ax.plot(x, y)
28+
ax.set_xscale('logit')
2829
ax.grid(True)
30+
bbox = ax.get_tightbbox(fig.canvas.get_renderer())
31+
assert np.isfinite(bbox.x0)
32+
assert np.isfinite(bbox.y0)
2933

3034

3135
def test_log_scatter():

0 commit comments

Comments
 (0)