diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 65ddd128b72a..5bad8182d135 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -1800,11 +1800,11 @@ def test_boxplot_sym(): def test_boxplot_autorange_whiskers(): x = np.ones(140) x = np.hstack([0, x, 2]) - + fig1, ax1 = plt.subplots() ax1.boxplot([x, x], bootstrap=10000, notch=1) ax1.set_ylim((-5, 5)) - + fig2, ax2 = plt.subplots() ax2.boxplot([x, x], bootstrap=10000, notch=1, autorange=True) ax2.set_ylim((-5, 5)) @@ -4312,6 +4312,13 @@ def test_date_timezone_x_and_y(): plt.plot_date(time_index, time_index, tz='US/Eastern', ydate=True) +@cleanup +def test_large_offset(): + fig, ax = plt.subplots() + ax.plot((1 + np.array([0, 1.e-12])) * 1.e27) + fig.canvas.draw() + + if __name__ == '__main__': import nose import sys diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 8f50071f3757..684073984424 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -551,9 +551,9 @@ def _set_offset(self, range): if np.absolute(ave_oom - range_oom) >= 3: # four sig-figs p10 = 10 ** range_oom if ave_loc < 0: - self.offset = (math.ceil(np.max(locs) / p10) * p10) + self.offset = (np.ceil(np.max(locs) / p10) * p10) else: - self.offset = (math.floor(np.min(locs) / p10) * p10) + self.offset = (np.floor(np.min(locs) / p10) * p10) else: self.offset = 0