Skip to content

Commit b946dd0

Browse files
committed
Merge pull request #6434 from tacaswell/fix_np_obj_array_bug
FIX: convert to use numpy floor/ceil
2 parents 7a80933 + db01685 commit b946dd0

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

lib/matplotlib/tests/test_axes.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -1800,11 +1800,11 @@ def test_boxplot_sym():
18001800
def test_boxplot_autorange_whiskers():
18011801
x = np.ones(140)
18021802
x = np.hstack([0, x, 2])
1803-
1803+
18041804
fig1, ax1 = plt.subplots()
18051805
ax1.boxplot([x, x], bootstrap=10000, notch=1)
18061806
ax1.set_ylim((-5, 5))
1807-
1807+
18081808
fig2, ax2 = plt.subplots()
18091809
ax2.boxplot([x, x], bootstrap=10000, notch=1, autorange=True)
18101810
ax2.set_ylim((-5, 5))
@@ -4312,6 +4312,13 @@ def test_date_timezone_x_and_y():
43124312
plt.plot_date(time_index, time_index, tz='US/Eastern', ydate=True)
43134313

43144314

4315+
@cleanup
4316+
def test_large_offset():
4317+
fig, ax = plt.subplots()
4318+
ax.plot((1 + np.array([0, 1.e-12])) * 1.e27)
4319+
fig.canvas.draw()
4320+
4321+
43154322
if __name__ == '__main__':
43164323
import nose
43174324
import sys

lib/matplotlib/ticker.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,9 @@ def _set_offset(self, range):
551551
if np.absolute(ave_oom - range_oom) >= 3: # four sig-figs
552552
p10 = 10 ** range_oom
553553
if ave_loc < 0:
554-
self.offset = (math.ceil(np.max(locs) / p10) * p10)
554+
self.offset = (np.ceil(np.max(locs) / p10) * p10)
555555
else:
556-
self.offset = (math.floor(np.min(locs) / p10) * p10)
556+
self.offset = (np.floor(np.min(locs) / p10) * p10)
557557
else:
558558
self.offset = 0
559559

0 commit comments

Comments
 (0)