Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 513ff68

Browse files
committed
Merge pull request #4057 from WeatherGod/mplot3d/fix_future_warning
MNT : Avoid comparing None & numpy arrays
2 parents 1ab4891 + 7e0f22a commit 513ff68

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,8 +1008,11 @@ def mouse_init(self, rotate_btn=1, zoom_btn=3):
10081008
else:
10091009
warnings.warn('Axes3D.figure.canvas is \'None\', mouse rotation disabled. Set canvas then call Axes3D.mouse_init().')
10101010

1011-
self._rotate_btn = np.atleast_1d(rotate_btn)
1012-
self._zoom_btn = np.atleast_1d(zoom_btn)
1011+
# coerce scalars into array-like, then convert into
1012+
# a regular list to avoid comparisons against None
1013+
# which breaks in recent versions of numpy.
1014+
self._rotate_btn = np.atleast_1d(rotate_btn).tolist()
1015+
self._zoom_btn = np.atleast_1d(zoom_btn).tolist()
10131016

10141017
def can_zoom(self) :
10151018
"""

0 commit comments

Comments
 (0)