|
2 | 2 | import itertools |
3 | 3 | import logging |
4 | 4 | import math |
5 | | -from numbers import Integral, Number |
| 5 | +from numbers import Integral, Number, Real |
6 | 6 |
|
7 | 7 | import numpy as np |
8 | 8 | from numpy import ma |
@@ -582,7 +582,7 @@ def invert(x): |
582 | 582 | secax.set_xlabel('Period [s]') |
583 | 583 | plt.show() |
584 | 584 | """ |
585 | | - if location in ['top', 'bottom'] or isinstance(location, Number): |
| 585 | + if location in ['top', 'bottom'] or isinstance(location, Real): |
586 | 586 | secondary_ax = SecondaryAxis(self, 'x', location, functions, |
587 | 587 | **kwargs) |
588 | 588 | self.add_child_axes(secondary_ax) |
@@ -614,7 +614,7 @@ def secondary_yaxis(self, location, *, functions=None, **kwargs): |
614 | 614 | np.rad2deg)) |
615 | 615 | secax.set_ylabel('radians') |
616 | 616 | """ |
617 | | - if location in ['left', 'right'] or isinstance(location, Number): |
| 617 | + if location in ['left', 'right'] or isinstance(location, Real): |
618 | 618 | secondary_ax = SecondaryAxis(self, 'y', location, |
619 | 619 | functions, **kwargs) |
620 | 620 | self.add_child_axes(secondary_ax) |
@@ -3219,7 +3219,7 @@ def get_next_color(): |
3219 | 3219 |
|
3220 | 3220 | hatch_cycle = itertools.cycle(np.atleast_1d(hatch)) |
3221 | 3221 |
|
3222 | | - _api.check_isinstance(Number, radius=radius, startangle=startangle) |
| 3222 | + _api.check_isinstance(Real, radius=radius, startangle=startangle) |
3223 | 3223 | if radius <= 0: |
3224 | 3224 | raise ValueError(f'radius must be a positive number, not {radius}') |
3225 | 3225 |
|
@@ -4188,7 +4188,7 @@ def do_patch(xs, ys, **kwargs): |
4188 | 4188 | raise ValueError(datashape_message.format("positions")) |
4189 | 4189 |
|
4190 | 4190 | positions = np.array(positions) |
4191 | | - if len(positions) > 0 and not isinstance(positions[0], Number): |
| 4191 | + if len(positions) > 0 and not all(isinstance(p, Real) for p in positions): |
4192 | 4192 | raise TypeError("positions should be an iterable of numbers") |
4193 | 4193 |
|
4194 | 4194 | # width |
|
0 commit comments