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

Skip to content

Commit b7c5a92

Browse files
committed
FIX: flake8
1 parent 6e3f9bf commit b7c5a92

File tree

2 files changed

+11
-30
lines changed

2 files changed

+11
-30
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,6 @@ def secondary_xaxis(self, loc, conversion, **kwargs):
678678
self.add_child_axes(secondary_ax)
679679
return secondary_ax
680680

681-
682681
def secondary_yaxis(self, loc, conversion, **kwargs):
683682
"""
684683
Add a second y-axis to this axes.

lib/matplotlib/axes/_secondary_axes.py

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
AutoMinorLocator,
2121
)
2222

23+
2324
def _make_inset_locator(rect, trans, parent):
2425
"""
2526
Helper function to locate inset axes, used in
@@ -63,6 +64,7 @@ def _parse_conversion(name, otherargs):
6364
else:
6465
raise ValueError(f'"{name}" not a possible conversion string')
6566

67+
6668
class Secondary_Axis(_AxesBase):
6769
"""
6870
General class to hold a Secondary_X/Yaxis.
@@ -417,7 +419,7 @@ def transform_affine(self, values):
417419
return np.asarray(values) * self._slope + self._offset
418420

419421
def inverted(self):
420-
return _InvertedLinearTransform(self._slope, self._offset)
422+
return _InverseLinearTransform(self._slope, self._offset)
421423

422424

423425
class _InverseLinearTransform(mtransforms.AffineBase):
@@ -440,18 +442,20 @@ def transform_affine(self, values):
440442
def inverted(self):
441443
return _LinearTransform(self._slope, self._offset)
442444

445+
443446
def _mask_out_of_bounds(a):
444447
"""
445448
Return a Numpy array where all values outside ]0, 1[ are
446449
replaced with NaNs. If all values are inside ]0, 1[, the original
447450
array is returned.
448451
"""
449-
a = numpy.array(a, float)
452+
a = np.array(a, float)
450453
mask = (a <= 0.0) | (a >= 1.0)
451454
if mask.any():
452-
return numpy.where(mask, numpy.nan, a)
455+
return np.where(mask, np.nan, a)
453456
return a
454457

458+
455459
class _InvertTransform(mtransforms.Transform):
456460
"""
457461
Return a/x
@@ -462,16 +466,9 @@ class _InvertTransform(mtransforms.Transform):
462466
is_separable = True
463467
has_inverse = True
464468

465-
def __init__(self, fac, out_of_bounds='mask'):
469+
def __init__(self, fac):
466470
mtransforms.Transform.__init__(self)
467471
self._fac = fac
468-
self.out_of_bounds = out_of_bounds
469-
if self.out_of_bounds == 'mask':
470-
self._handle_out_of_bounds = _mask_out_of_bounds
471-
elif self.out_of_bounds == 'clip':
472-
self._handle_out_of_bounds = _clip_out_of_bounds
473-
else:
474-
raise ValueError("`out_of_bounds` muse be either 'mask' or 'clip'")
475472

476473
def transform_non_affine(self, values):
477474
with np.errstate(divide="ignore", invalid="ignore"):
@@ -493,22 +490,14 @@ class _PowerTransform(mtransforms.Transform):
493490
is_separable = True
494491
has_inverse = True
495492

496-
def __init__(self, a, b, out_of_bounds='mask'):
493+
def __init__(self, a, b):
497494
mtransforms.Transform.__init__(self)
498495
self._a = a
499496
self._b = b
500-
self.out_of_bounds = out_of_bounds
501-
if self.out_of_bounds == 'mask':
502-
self._handle_out_of_bounds = _mask_out_of_bounds
503-
elif self.out_of_bounds == 'clip':
504-
self._handle_out_of_bounds = _clip_out_of_bounds
505-
else:
506-
raise ValueError("`out_of_bounds` muse be either 'mask' or 'clip'")
507497

508498
def transform_non_affine(self, values):
509499
with np.errstate(divide="ignore", invalid="ignore"):
510500
q = self._b * (values ** self._a)
511-
print('forward', values, q)
512501
return q
513502

514503
def inverted(self):
@@ -526,21 +515,14 @@ class _InversePowerTransform(mtransforms.Transform):
526515
is_separable = True
527516
has_inverse = True
528517

529-
def __init__(self, a, b, out_of_bounds='mask'):
518+
def __init__(self, a, b):
530519
mtransforms.Transform.__init__(self)
531520
self._a = a
532521
self._b = b
533-
self.out_of_bounds = out_of_bounds
534-
if self.out_of_bounds == 'mask':
535-
self._handle_out_of_bounds = _mask_out_of_bounds
536-
elif self.out_of_bounds == 'clip':
537-
self._handle_out_of_bounds = _clip_out_of_bounds
538-
else:
539-
raise ValueError("`out_of_bounds` must be either 'mask' or 'clip'")
540522

541523
def transform_non_affine(self, values):
542524
with np.errstate(divide="ignore", invalid="ignore"):
543-
q = (values / self._b) ** (1 / self._a)
525+
q = (values / self._b) ** (1 / self._a)
544526
print(values, q)
545527
return q
546528

0 commit comments

Comments
 (0)