diff --git a/lib/matplotlib/tests/baseline_images/test_axes/autoscale_tiny_range.pdf b/lib/matplotlib/tests/baseline_images/test_axes/autoscale_tiny_range.pdf
index 815604f0f66a..42652378a5d0 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_axes/autoscale_tiny_range.pdf and b/lib/matplotlib/tests/baseline_images/test_axes/autoscale_tiny_range.pdf differ
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/autoscale_tiny_range.png b/lib/matplotlib/tests/baseline_images/test_axes/autoscale_tiny_range.png
index dfb608d5d915..8ea9d0c87528 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_axes/autoscale_tiny_range.png and b/lib/matplotlib/tests/baseline_images/test_axes/autoscale_tiny_range.png differ
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/autoscale_tiny_range.svg b/lib/matplotlib/tests/baseline_images/test_axes/autoscale_tiny_range.svg
index 8d91e8b5779a..e87ecb06a6bd 100644
--- a/lib/matplotlib/tests/baseline_images/test_axes/autoscale_tiny_range.svg
+++ b/lib/matplotlib/tests/baseline_images/test_axes/autoscale_tiny_range.svg
@@ -27,8 +27,8 @@ z
" style="fill:#ffffff;"/>
-
@@ -57,80 +57,80 @@ L 274.909091 43.2
+" id="m4a49543a7b" style="stroke:#000000;stroke-width:0.5;"/>
-
+
+" id="m1f573dd853" style="stroke:#000000;stroke-width:0.5;"/>
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -141,92 +141,80 @@ L 0 4
+" id="m3cbea2feae" style="stroke:#000000;stroke-width:0.5;"/>
-
+
+" id="mbcbe9233f6" style="stroke:#000000;stroke-width:0.5;"/>
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -241,19 +229,19 @@ L 315.490909 43.2
z
" style="fill:#ffffff;"/>
-
-
+
-
-
@@ -268,160 +256,148 @@ L 518.4 43.2
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
-
+
-
+
-
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -436,18 +412,18 @@ L 72 231.709091
z
" style="fill:#ffffff;"/>
-
-
+
-
-
@@ -463,148 +439,136 @@ L 274.909091 231.709091
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
@@ -619,18 +583,18 @@ L 315.490909 231.709091
z
" style="fill:#ffffff;"/>
-
-
+
-
-
@@ -646,148 +610,136 @@ L 518.4 231.709091
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
@@ -795,17 +747,17 @@ L 518.4 231.709091
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/bar_tick_label_single.png b/lib/matplotlib/tests/baseline_images/test_axes/bar_tick_label_single.png
index 2ecd9bda53f5..12341f43896c 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_axes/bar_tick_label_single.png and b/lib/matplotlib/tests/baseline_images/test_axes/bar_tick_label_single.png differ
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/errorbar_mixed.pdf b/lib/matplotlib/tests/baseline_images/test_axes/errorbar_mixed.pdf
index 019e16d8fa93..7440796c1216 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_axes/errorbar_mixed.pdf and b/lib/matplotlib/tests/baseline_images/test_axes/errorbar_mixed.pdf differ
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/errorbar_mixed.svg b/lib/matplotlib/tests/baseline_images/test_axes/errorbar_mixed.svg
index be9353c223a4..eb4c6b267525 100644
--- a/lib/matplotlib/tests/baseline_images/test_axes/errorbar_mixed.svg
+++ b/lib/matplotlib/tests/baseline_images/test_axes/errorbar_mixed.svg
@@ -27,28 +27,28 @@ z
" style="fill:#ffffff;"/>
-
-
-
-
-
-
-
-
@@ -56,29 +56,29 @@ L 214.036364 121.211578
+" id="mbcc6b89cea" style="stroke:#0000ff;stroke-width:0.5;"/>
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -93,17 +93,17 @@ C -2.683901 -1.55874 -3 -0.795609 -3 0
C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132
C -1.55874 2.683901 -0.795609 3 0 3
z
-" id="mb6e84590ae" style="stroke:#000000;stroke-width:0.500000;"/>
+" id="m3ab0696531" style="stroke:#000000;stroke-width:0.5;"/>
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -132,68 +132,68 @@ L 274.909091 43.2
+" id="mc07735dae7" style="stroke:#000000;stroke-width:0.5;"/>
-
+
+" id="m285f384398" style="stroke:#000000;stroke-width:0.5;"/>
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -204,20 +204,20 @@ L 0 4
+" id="mc6dc0590f7" style="stroke:#000000;stroke-width:0.5;"/>
-
+
+" id="m77df9ad106" style="stroke:#000000;stroke-width:0.5;"/>
-
+
@@ -279,63 +279,63 @@ Q 14.890625 38.140625 10.796875 36.28125
z
" id="DejaVuSans-35"/>
-
+
-
-
-
+
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
@@ -355,30 +355,30 @@ L 12.40625 0
z
" id="DejaVuSans-31"/>
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
@@ -562,22 +562,22 @@ Q 37.15625 56 41.109375 55.140625
Q 45.0625 54.296875 48.78125 52.59375
" id="DejaVuSans-63"/>
-
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -591,58 +591,58 @@ z
" style="fill:#ffffff;"/>
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+" style="fill:none;stroke:#0000ff;stroke-opacity:0.4;"/>
+" id="m18cd8ead98" style="stroke:#0000ff;stroke-width:0.5;"/>
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -657,17 +657,17 @@ C -2.683901 -1.55874 -3 -0.795609 -3 0
C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132
C -1.55874 2.683901 -0.795609 3 0 3
z
-" id="m203a6b5dc5" style="stroke:#000000;stroke-width:0.500000;"/>
+" id="me1729a89a4" style="stroke:#000000;stroke-width:0.5;"/>
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -694,60 +694,60 @@ L 518.4 43.2
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -756,32 +756,32 @@ L 518.4 43.2
-
+
-
+
-
+
-
-
+
+
-
+
-
+
@@ -811,22 +811,22 @@ Q 44.1875 33.984375 37.640625 27.21875
Q 31.109375 20.453125 19.1875 8.296875
" id="DejaVuSans-32"/>
-
+
-
-
+
+
-
+
-
+
@@ -850,22 +850,22 @@ L 4.890625 26.703125
z
" id="DejaVuSans-34"/>
-
+
-
-
+
+
-
+
-
+
@@ -900,22 +900,22 @@ Q 40.921875 74.21875 44.703125 73.484375
Q 48.484375 72.75 52.59375 71.296875
" id="DejaVuSans-36"/>
-
+
-
-
+
+
-
+
-
+
@@ -958,30 +958,30 @@ Q 25.390625 66.40625 21.84375 63.234375
Q 18.3125 60.0625 18.3125 54.390625
" id="DejaVuSans-38"/>
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
@@ -1123,30 +1123,30 @@ Q 45.21875 56 50.046875 50.171875
Q 54.890625 44.34375 54.890625 33.015625
" id="DejaVuSans-68"/>
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
@@ -1160,54 +1160,54 @@ z
" style="fill:#ffffff;"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1215,57 +1215,57 @@ L 214.036364 272.060219
+" id="m3fce235567" style="stroke:#0000ff;stroke-width:0.5;"/>
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+" style="fill:none;stroke:#0000ff;stroke-dasharray:6,6;stroke-dashoffset:0;"/>
+
+
+
+
+
+
+
+
+
@@ -1309,36 +1309,36 @@ L 274.909091 231.709091
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -1346,17 +1346,17 @@ L 274.909091 231.709091
-
+
-
+
-
+
@@ -1364,17 +1364,17 @@ L 274.909091 231.709091
-
+
-
+
-
+
@@ -1382,17 +1382,17 @@ L 274.909091 231.709091
-
+
-
+
-
+
@@ -1402,101 +1402,101 @@ L 274.909091 231.709091
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
@@ -1513,22 +1513,22 @@ L 11.71875 4
z
" id="DejaVuSans-2c"/>
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -1542,54 +1542,54 @@ z
" style="fill:#ffffff;"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1597,70 +1597,70 @@ L 457.527273 284.387119
+" id="m5964813c2a" style="stroke:#008000;stroke-width:2;"/>
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+" id="meebb5c6abb" style="stroke:#008000;stroke-width:2;"/>
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -1687,36 +1687,36 @@ L 518.4 231.709091
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -1724,17 +1724,17 @@ L 518.4 231.709091
-
+
-
+
-
+
@@ -1742,17 +1742,17 @@ L 518.4 231.709091
-
+
-
+
-
+
@@ -1760,17 +1760,17 @@ L 518.4 231.709091
-
+
-
+
-
+
@@ -1780,12 +1780,12 @@ L 518.4 231.709091
-
+
-
+
@@ -1798,72 +1798,72 @@ L 4.890625 23.390625
z
" id="DejaVuSans-2d"/>
-
-
+
+
-
-
+
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
@@ -1872,296 +1872,296 @@ z
+" id="mca387c22eb" style="stroke:#000000;stroke-width:0.5;"/>
-
+
+" id="m28adb0da7f" style="stroke:#000000;stroke-width:0.5;"/>
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -2255,24 +2255,24 @@ L 54.390625 54.6875
z
" id="DejaVuSans-67"/>
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2304,40 +2304,40 @@ L 18.109375 75.984375
z
" id="DejaVuSans-62"/>
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.pdf b/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.pdf
index ec3ad7f1ce74..9e01faa80dc5 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.pdf and b/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.pdf differ
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.png b/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.png
index 457a4cdcbfae..6f7132fff3e8 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.png and b/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.png differ
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.svg b/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.svg
index 20b200e11b39..14da6b32613b 100644
--- a/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.svg
+++ b/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.svg
@@ -27,8 +27,8 @@ z
" style="fill:#ffffff;"/>
-
@@ -57,20 +57,20 @@ L 518.400024 43.2
+" id="md38084f2cb" style="stroke:#000000;stroke-width:0.5;"/>
-
+
+" id="m1053aa6e80" style="stroke:#000000;stroke-width:0.5;"/>
-
+
@@ -115,22 +115,22 @@ Q 6.59375 54.828125 13.0625 64.515625
Q 19.53125 74.21875 31.78125 74.21875
" id="DejaVuSans-30"/>
-
+
-
-
+
+
-
+
-
+
@@ -160,22 +160,22 @@ Q 44.1875 33.984375 37.640625 27.21875
Q 31.109375 20.453125 19.1875 8.296875
" id="DejaVuSans-32"/>
-
+
-
-
+
+
-
+
-
+
@@ -199,22 +199,22 @@ L 4.890625 26.703125
z
" id="DejaVuSans-34"/>
-
+
-
-
+
+
-
+
-
+
@@ -249,22 +249,22 @@ Q 40.921875 74.21875 44.703125 73.484375
Q 48.484375 72.75 52.59375 71.296875
" id="DejaVuSans-36"/>
-
+
-
-
+
+
-
+
-
+
@@ -307,54 +307,34 @@ Q 25.390625 66.40625 21.84375 63.234375
Q 18.3125 60.0625 18.3125 54.390625
" id="DejaVuSans-38"/>
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
+" id="mbea9ab30a9" style="stroke:#000000;stroke-width:0.5;"/>
-
+
-
+
+" id="m340098366b" style="stroke:#000000;stroke-width:0.5;"/>
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
-
-
-
+
+
+
-
-
+
+
diff --git a/lib/matplotlib/tests/baseline_images/test_axes/twin_spines_on_top.png b/lib/matplotlib/tests/baseline_images/test_axes/twin_spines_on_top.png
index a9434cc36704..26cce15de26c 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_axes/twin_spines_on_top.png and b/lib/matplotlib/tests/baseline_images/test_axes/twin_spines_on_top.png differ
diff --git a/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.pdf b/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.pdf
index eb50707aeb4f..2a7484d0b7a1 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.pdf and b/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.pdf differ
diff --git a/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.png b/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.png
index ed474046d505..b0aedc586ef6 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.png and b/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.png differ
diff --git a/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.svg b/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.svg
index c6f02bb31839..60783225d047 100644
--- a/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.svg
+++ b/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.svg
@@ -26,8 +26,8 @@ L 7.2 7.2
z
" style="fill:#ffffff;"/>
-
+
+" id="m5bec3d9599" style="stroke:#000000;stroke-width:0.5;"/>
-
+
+" id="me67d15b192" style="stroke:#000000;stroke-width:0.5;"/>
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -138,92 +138,80 @@ L 0 4
+" id="m60f474c7a2" style="stroke:#000000;stroke-width:0.5;"/>
-
+
+" id="m833b6c161b" style="stroke:#000000;stroke-width:0.5;"/>
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py
index df0e48e0cef0..83dacc71d9ca 100644
--- a/lib/matplotlib/tests/test_axes.py
+++ b/lib/matplotlib/tests/test_axes.py
@@ -22,7 +22,7 @@
from matplotlib.testing.decorators import image_comparison, cleanup
import matplotlib.pyplot as plt
import matplotlib.markers as mmarkers
-from numpy.testing import assert_array_equal
+from numpy.testing import assert_allclose, assert_array_equal
import warnings
from matplotlib.cbook import IgnoredKeywordWarning
@@ -3715,8 +3715,7 @@ def test_vline_limit():
ax.axvline(0.5)
ax.plot([-0.1, 0, 0.2, 0.1])
(ymin, ymax) = ax.get_ylim()
- assert ymin == -0.1
- assert ymax == 0.25
+ assert_allclose(ax.get_ylim(), (-.1, .2))
@cleanup
diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py
index 7455d03365a2..231a5f3193a0 100644
--- a/lib/matplotlib/ticker.py
+++ b/lib/matplotlib/ticker.py
@@ -161,6 +161,7 @@
from matplotlib import rcParams
from matplotlib import cbook
from matplotlib import transforms as mtransforms
+from matplotlib.cbook import mplDeprecation
import warnings
@@ -168,6 +169,15 @@
long = int
+# Work around numpy/numpy#6127.
+def _divmod(x, y):
+ if isinstance(x, np.generic):
+ x = x.item()
+ if isinstance(y, np.generic):
+ y = y.item()
+ return six.moves.builtins.divmod(x, y)
+
+
def _mathdefault(s):
"""
For backward compatibility, in classic mode we display
@@ -1221,7 +1231,7 @@ def view_limits(self, vmin, vmax):
vmax += 1
if rcParams['axes.autolimit_mode'] == 'round_numbers':
- exponent, remainder = divmod(math.log10(vmax - vmin), 1)
+ exponent, remainder = _divmod(math.log10(vmax - vmin), 1)
if remainder < 0.5:
exponent -= 1
scale = 10 ** (-exponent)
@@ -1247,14 +1257,14 @@ def __init__(self, base):
def lt(self, x):
'return the largest multiple of base < x'
- d, m = divmod(x, self._base)
+ d, m = _divmod(x, self._base)
if closeto(m, 0) and not closeto(m / self._base, 1):
return (d - 1) * self._base
return d * self._base
def le(self, x):
'return the largest multiple of base <= x'
- d, m = divmod(x, self._base)
+ d, m = _divmod(x, self._base)
if closeto(m / self._base, 1): # was closeto(m, self._base)
#looks like floating point error
return (d + 1) * self._base
@@ -1262,7 +1272,7 @@ def le(self, x):
def gt(self, x):
'return the smallest multiple of base > x'
- d, m = divmod(x, self._base)
+ d, m = _divmod(x, self._base)
if closeto(m / self._base, 1):
#looks like floating point error
return (d + 2) * self._base
@@ -1270,7 +1280,7 @@ def gt(self, x):
def ge(self, x):
'return the smallest multiple of base >= x'
- d, m = divmod(x, self._base)
+ d, m = _divmod(x, self._base)
if closeto(m, 0) and not closeto(m / self._base, 1):
return d * self._base
return (d + 1) * self._base
@@ -1326,23 +1336,13 @@ def view_limits(self, dmin, dmax):
def scale_range(vmin, vmax, n=1, threshold=100):
- dv = abs(vmax - vmin)
- if dv == 0: # maxabsv == 0 is a special case of this.
- return 1.0, 0.0
- # Note: this should never occur because
- # vmin, vmax should have been checked by nonsingular(),
- # and spread apart if necessary.
- meanv = 0.5 * (vmax + vmin)
+ dv = abs(vmax - vmin) # > 0 as nonsingular is called before.
+ meanv = (vmax + vmin) / 2
if abs(meanv) / dv < threshold:
offset = 0
- elif meanv > 0:
- ex = divmod(math.log10(meanv), 1)[0]
- offset = 10 ** ex
else:
- ex = divmod(math.log10(-meanv), 1)[0]
- offset = -10 ** ex
- ex = divmod(math.log10(dv / n), 1)[0]
- scale = 10 ** ex
+ offset = math.copysign(10 ** (math.log10(abs(meanv)) // 1), meanv)
+ scale = 10 ** (math.log10(dv / n) // 1)
return scale, offset
@@ -1352,7 +1352,6 @@ class MaxNLocator(Locator):
"""
default_params = dict(nbins=10,
steps=None,
- trim=True,
integer=False,
symmetric=False,
prune=None)
@@ -1388,9 +1387,6 @@ def __init__(self, *args, **kwargs):
will be removed. If prune==None, no ticks will be removed.
"""
- # I left "trim" out; it defaults to True, and it is not
- # clear that there is any use case for False, so we may
- # want to remove that kwarg. EF 2010/04/18
if args:
kwargs['nbins'] = args[0]
if len(args) > 1:
@@ -1406,7 +1402,9 @@ def set_params(self, **kwargs):
if self._nbins != 'auto':
self._nbins = int(self._nbins)
if 'trim' in kwargs:
- self._trim = kwargs['trim']
+ warnings.warn(
+ "The 'trim' keyword has no effect since version 2.0.",
+ mplDeprecation)
if 'integer' in kwargs:
self._integer = kwargs['integer']
if 'symmetric' in kwargs:
@@ -1429,9 +1427,9 @@ def set_params(self, **kwargs):
if 'integer' in kwargs:
self._integer = kwargs['integer']
if self._integer:
- self._steps = [n for n in self._steps if divmod(n, 1)[1] < 0.001]
+ self._steps = [n for n in self._steps if _divmod(n, 1)[1] < 0.001]
- def bin_boundaries(self, vmin, vmax):
+ def _raw_ticks(self, vmin, vmax):
nbins = self._nbins
if nbins == 'auto':
nbins = max(min(self.axis.get_tick_space(), 9), 1)
@@ -1449,23 +1447,30 @@ def bin_boundaries(self, vmin, vmax):
if step < scaled_raw_step:
continue
step *= scale
- best_vmin = step * divmod(vmin, step)[0]
+ best_vmin = vmin // step * step
best_vmax = best_vmin + step * nbins
- if (best_vmax >= vmax):
+ if best_vmax >= vmax:
break
- if self._trim:
- extra_bins = int(divmod((best_vmax - vmax), step)[0])
- nbins -= extra_bins
- return (np.arange(nbins + 1) * step + best_vmin + offset)
+
+ # More than nbins may be required, e.g. vmin, vmax = -4.1, 4.1 gives
+ # nbins=9 but 10 bins are actually required after rounding. So we just
+ # create the bins that span the range we need instead.
+ low = round(Base(step).le(vmin - best_vmin) / step)
+ high = round(Base(step).ge(vmax - best_vmin) / step)
+ return np.arange(low, high + 1) * step + best_vmin + offset
+
+ @cbook.deprecated("2.0")
+ def bin_boundaries(self, vmin, vmax):
+ return self._raw_ticks(vmin, vmax)
def __call__(self):
vmin, vmax = self.axis.get_view_interval()
return self.tick_values(vmin, vmax)
def tick_values(self, vmin, vmax):
- vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander=1e-13,
- tiny=1e-14)
- locs = self.bin_boundaries(vmin, vmax)
+ vmin, vmax = mtransforms.nonsingular(
+ vmin, vmax, expander=1e-13, tiny=1e-14)
+ locs = self._raw_ticks(vmin, vmax)
prune = self._prune
if prune == 'lower':
locs = locs[1:]
@@ -1482,11 +1487,11 @@ def view_limits(self, dmin, dmax):
dmin = -maxabs
dmax = maxabs
- dmin, dmax = mtransforms.nonsingular(dmin, dmax, expander=1e-12,
- tiny=1.e-13)
+ dmin, dmax = mtransforms.nonsingular(
+ dmin, dmax, expander=1e-12, tiny=1e-13)
if rcParams['axes.autolimit_mode'] == 'round_numbers':
- return np.take(self.bin_boundaries(dmin, dmax), [0, -1])
+ return self._raw_ticks(dmin, dmax)[[0, -1]]
else:
return dmin, dmax
diff --git a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d.pdf b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d.pdf
index 58524d9e9019..5594461185a7 100644
Binary files a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d.pdf and b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d.pdf differ
diff --git a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d.png b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d.png
index 700dcd069e41..130d5d21e56c 100644
Binary files a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d.png and b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d.png differ
diff --git a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d.svg b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d.svg
index 1cbb2c79a1f8..ea4484f6ea4d 100644
--- a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d.svg
+++ b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d.svg
@@ -301,37 +301,33 @@ L 474.560748 108.278886
L 258.89869 224.615172
L 131.001569 309.196909
" style="fill:none;stroke:#e6e6e6;"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -411,2712 +400,2712 @@ L 478.01998 112.499596
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_masked.pdf b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_masked.pdf
index 5db55fa9ecdd..f5cf57d6e9d6 100644
Binary files a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_masked.pdf and b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_masked.pdf differ
diff --git a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_masked.png b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_masked.png
index 0595dc1febd2..1f12e7b4077d 100644
Binary files a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_masked.png and b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_masked.png differ
diff --git a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_masked.svg b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_masked.svg
index 190bf1bc15ba..0b9227cce183 100644
--- a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_masked.svg
+++ b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_masked.svg
@@ -301,37 +301,33 @@ L 474.560748 108.278886
L 258.89869 224.615172
L 131.001569 309.196909
" style="fill:none;stroke:#e6e6e6;"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -411,1335 +400,1335 @@ L 478.01998 112.499596
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_pivot_middle.png b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_pivot_middle.png
index 9143746d0646..6809caa61fd3 100644
Binary files a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_pivot_middle.png and b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_pivot_middle.png differ
diff --git a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_pivot_tail.png b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_pivot_tail.png
index 7ab9fcc5dfd2..1352d5bf8d5a 100644
Binary files a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_pivot_tail.png and b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/quiver3d_pivot_tail.png differ