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

Skip to content

Commit 0ea2013

Browse files
authored
Merge pull request #15694 from anntzer/unfloat
Handle upcoming deprecation of np.float.
2 parents 6b1d416 + d54975e commit 0ea2013

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

lib/matplotlib/projections/polar.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -719,9 +719,7 @@ class _WedgeBbox(mtransforms.Bbox):
719719
Bbox determining the origin for the wedge, if different from *viewLim*
720720
"""
721721
def __init__(self, center, viewLim, originLim, **kwargs):
722-
mtransforms.Bbox.__init__(self,
723-
np.array([[0.0, 0.0], [1.0, 1.0]], np.float),
724-
**kwargs)
722+
mtransforms.Bbox.__init__(self, [[0, 0], [1, 1]], **kwargs)
725723
self._center = center
726724
self._viewLim = viewLim
727725
self._originLim = originLim

lib/matplotlib/transforms.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -763,12 +763,12 @@ def invalidate(self):
763763
@staticmethod
764764
def unit():
765765
"""Create a new unit `Bbox` from (0, 0) to (1, 1)."""
766-
return Bbox(np.array([[0.0, 0.0], [1.0, 1.0]], float))
766+
return Bbox([[0, 0], [1, 1]])
767767

768768
@staticmethod
769769
def null():
770770
"""Create a new null `Bbox` from (inf, inf) to (-inf, -inf)."""
771-
return Bbox(np.array([[np.inf, np.inf], [-np.inf, -np.inf]], float))
771+
return Bbox([[np.inf, np.inf], [-np.inf, -np.inf]])
772772

773773
@staticmethod
774774
def from_bounds(x0, y0, width, height):
@@ -786,8 +786,7 @@ def from_extents(*args):
786786
787787
The *y*-axis increases upwards.
788788
"""
789-
points = np.array(args, dtype=float).reshape(2, 2)
790-
return Bbox(points)
789+
return Bbox(np.reshape(args, (2, 2)))
791790

792791
def __format__(self, fmt):
793792
return (

lib/matplotlib/units.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,8 @@ def is_numlike(x):
155155

156156

157157
class DecimalConverter(ConversionInterface):
158-
"""
159-
Converter for decimal.Decimal data to float.
160-
"""
158+
"""Converter for decimal.Decimal data to float."""
159+
161160
@staticmethod
162161
def convert(value, unit, axis):
163162
"""
@@ -172,13 +171,13 @@ def convert(value, unit, axis):
172171
"""
173172
# If value is a Decimal
174173
if isinstance(value, Decimal):
175-
return np.float(value)
174+
return float(value)
176175
else:
177176
# assume x is a list of Decimal
178177
converter = np.asarray
179178
if isinstance(value, ma.MaskedArray):
180179
converter = ma.asarray
181-
return converter(value, dtype=np.float)
180+
return converter(value, dtype=float)
182181

183182
@staticmethod
184183
def axisinfo(unit, axis):

0 commit comments

Comments
 (0)