Skip to content

FIX: better default spine path (for logit) #11417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/matplotlib/spines.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion lib/matplotlib/tests/test_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@ 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,
0.6, 0.7, 0.8, 0.9, 0.97, 0.99, 0.997, 0.999])
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():
Expand Down