From 5697ba9fe5eda05306e9adb35d7cd2a6a2db8124 Mon Sep 17 00:00:00 2001 From: Eric Firing Date: Wed, 9 Nov 2016 09:36:00 -1000 Subject: [PATCH] restore test that was inadvertently removed by 5901b38 --- lib/matplotlib/tests/test_axes.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index dd9c298575dc..7290edfde948 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4799,6 +4799,21 @@ def test_fillbetween_cycle(): assert tuple(cc.get_edgecolors().squeeze()) == tuple(edge_target) +@cleanup +def test_log_margins(): + plt.rcParams['axes.autolimit_mode'] = 'data' + fig, ax = plt.subplots() + margin = 0.05 + ax.set_xmargin(margin) + ax.semilogx([1, 10], [1, 10]) + xlim0, xlim1 = ax.get_xlim() + transform = ax.xaxis.get_transform() + xlim0t, xlim1t = transform.transform([xlim0, xlim1]) + x0t, x1t = transform.transform([1, 10]) + delta = (x1t - x0t) * margin + assert_allclose([xlim0t + delta, xlim1t - delta], [x0t, x1t]) + + @cleanup def test_color_length_mismatch(): N = 5 @@ -4809,4 +4824,4 @@ def test_color_length_mismatch(): ax.scatter(x, y, c=colors) c_rgb = (0.5, 0.5, 0.5) ax.scatter(x, y, c=c_rgb) - ax.scatter(x, y, c=[c_rgb] * N) \ No newline at end of file + ax.scatter(x, y, c=[c_rgb] * N)