Skip to content

Commit dd8f0c6

Browse files
trygvradtimhoffm
andcommitted
Apply suggestions from code review
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
1 parent 3a4f6b9 commit dd8f0c6

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

lib/matplotlib/colors.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3352,7 +3352,7 @@ def n_components(self):
33523352

33533353
@property
33543354
def norms(self):
3355-
"""The individual norms held by this `MultiNorm`"""
3355+
"""The individual norms held by this `MultiNorm`."""
33563356
return self._norms
33573357

33583358
@property
@@ -3361,10 +3361,10 @@ def vmin(self):
33613361
return tuple(n.vmin for n in self._norms)
33623362

33633363
@vmin.setter
3364-
def vmin(self, value):
3365-
value = np.broadcast_to(value, self.n_components)
3364+
def vmin(self, values):
3365+
values = np.broadcast_to(values, self.n_components)
33663366
with self.callbacks.blocked():
3367-
for norm, v in zip(self.norms, value):
3367+
for norm, v in zip(self.norms, values):
33683368
if v is not None:
33693369
norm.vmin = v
33703370
self._changed()
@@ -3375,10 +3375,10 @@ def vmax(self):
33753375
return tuple(n.vmax for n in self._norms)
33763376

33773377
@vmax.setter
3378-
def vmax(self, value):
3379-
value = np.broadcast_to(value, self.n_components)
3378+
def vmax(self, values):
3379+
value = np.broadcast_to(values, self.n_components)
33803380
with self.callbacks.blocked():
3381-
for norm, v in zip(self.norms, value):
3381+
for norm, v in zip(self.norms, values):
33823382
if v is not None:
33833383
norm.vmax = v
33843384
self._changed()
@@ -3389,10 +3389,10 @@ def clip(self):
33893389
return tuple(n.clip for n in self._norms)
33903390

33913391
@clip.setter
3392-
def clip(self, value):
3393-
value = np.broadcast_to(value, self.n_components)
3392+
def clip(self, values):
3393+
values = np.broadcast_to(values, self.n_components)
33943394
with self.callbacks.blocked():
3395-
for norm, v in zip(self.norms, value):
3395+
for norm, v in zip(self.norms, values):
33963396
if v is not None:
33973397
norm.clip = v
33983398
self._changed()
@@ -3404,15 +3404,15 @@ def _changed(self):
34043404
"""
34053405
self.callbacks.process('changed')
34063406

3407-
def __call__(self, value, clip=None, structured_output=None):
3407+
def __call__(self, values, clip=None, structured_output=None):
34083408
"""
34093409
Normalize the data and return the normalized data.
34103410
3411-
Each component of the input is assigned to the constituent norm.
3411+
Each component of the input is normalized via the constituent norm.
34123412
34133413
Parameters
34143414
----------
3415-
value : array-like
3415+
values : array-like
34163416
Data to normalize, as tuple, scalar array or structured array.
34173417
34183418
- If tuple, must be of length `n_components`
@@ -3439,44 +3439,44 @@ def __call__(self, value, clip=None, structured_output=None):
34393439
Notes
34403440
-----
34413441
If not already initialized, ``self.vmin`` and ``self.vmax`` are
3442-
initialized using ``self.autoscale_None(value)``.
3442+
initialized using ``self.autoscale_None(values)``.
34433443
"""
34443444
if clip is None:
34453445
clip = self.clip
34463446
elif not np.iterable(clip):
34473447
clip = [clip]*self.n_components
34483448

34493449
if structured_output is None:
3450-
if isinstance(value, np.ndarray) and value.dtype.fields is not None:
3450+
if isinstance(values, np.ndarray) and values.dtype.fields is not None:
34513451
structured_output = True
34523452
else:
34533453
structured_output = False
34543454

3455-
value = self._iterable_components_in_data(value, self.n_components)
3455+
values = self._iterable_components_in_data(values, self.n_components)
34563456

3457-
result = tuple(n(v, clip=c) for n, v, c in zip(self.norms, value, clip))
3457+
result = tuple(n(v, clip=c) for n, v, c in zip(self.norms, values, clip))
34583458

34593459
if structured_output:
34603460
result = self._ensure_multicomponent_data(result, self.n_components)
34613461

34623462
return result
34633463

3464-
def inverse(self, value):
3464+
def inverse(self, values):
34653465
"""
3466-
Map the normalized value (i.e., index in the colormap) back to image data value.
3466+
Map the normalized values (i.e., index in the colormap) back to data values.
34673467
34683468
Parameters
34693469
----------
3470-
value
3471-
Normalized value, as tuple, scalar array or structured array.
3470+
values
3471+
Normalized values, as tuple, scalar array or structured array.
34723472
34733473
- If tuple, must be of length `n_components`
34743474
- If scalar array, the first axis must be of length `n_components`
34753475
- If structured array, must have `n_components` fields.
34763476
34773477
"""
3478-
value = self._iterable_components_in_data(value, self.n_components)
3479-
result = [n.inverse(v) for n, v in zip(self.norms, value)]
3478+
values = self._iterable_components_in_data(values, self.n_components)
3479+
result = [n.inverse(v) for n, v in zip(self.norms, values)]
34803480
return result
34813481

34823482
def autoscale(self, A):
@@ -3487,8 +3487,8 @@ def autoscale(self, A):
34873487
Parameters
34883488
----------
34893489
A
3490-
Data, must be of length `n_components` or be a structured array or scalar
3491-
with `n_components` fields.
3490+
Data, must be of length `n_components` or be a structured scalar or
3491+
structured array with `n_components` fields.
34923492
"""
34933493
with self.callbacks.blocked():
34943494
# Pause callbacks while we are updating so we only get
@@ -3561,7 +3561,7 @@ def _ensure_multicomponent_data(data, n_components):
35613561
Parameters
35623562
----------
35633563
n_components : int
3564-
- number of omponents in the data
3564+
Number of omponents in the data.
35653565
data : np.ndarray, PIL.Image or None
35663566
35673567
Returns

lib/matplotlib/colors.pyi

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -430,30 +430,30 @@ class MultiNorm(Norm):
430430
@property # type: ignore[override]
431431
def vmin(self) -> tuple[float | None, ...]: ...
432432
@vmin.setter
433-
def vmin(self, value: ArrayLike | float | None) -> None: ...
433+
def vmin(self, values: ArrayLike | float | None) -> None: ...
434434
@property # type: ignore[override]
435435
def vmax(self) -> tuple[float | None, ...]: ...
436436
@vmax.setter
437-
def vmax(self, value: ArrayLike | float | None) -> None: ...
437+
def vmax(self, valued: ArrayLike | float | None) -> None: ...
438438
@property # type: ignore[override]
439439
def clip(self) -> tuple[bool, ...]: ...
440440
@clip.setter
441-
def clip(self, value: ArrayLike | bool) -> None: ...
441+
def clip(self, values: ArrayLike | bool) -> None: ...
442442
@overload
443-
def __call__(self, value: tuple, clip: ArrayLike | bool | None = ..., structured_output: Literal[False] = ...) -> tuple: ...
443+
def __call__(self, values: tuple, clip: ArrayLike | bool | None = ..., structured_output: Literal[False] = ...) -> tuple: ...
444444
@overload
445-
def __call__(self, value: tuple, structured_output: Literal[True], clip: ArrayLike | bool | None = ...) -> np.ma.MaskedArray: ...
445+
def __call__(self, values: tuple, structured_output: Literal[True], clip: ArrayLike | bool | None = ...) -> np.ma.MaskedArray: ...
446446
@overload
447-
def __call__(self, value: np.ndarray, clip: ArrayLike | bool | None = ..., structured_output: None | Literal[True] = ...) -> np.ma.MaskedArray: ...
447+
def __call__(self, values: np.ndarray, clip: ArrayLike | bool | None = ..., structured_output: None | Literal[True] = ...) -> np.ma.MaskedArray: ...
448448
@overload
449-
def __call__(self, value: np.ndarray, structured_output: Literal[False], clip: ArrayLike | bool | None = ...) -> tuple: ...
449+
def __call__(self, values: np.ndarray, structured_output: Literal[False], clip: ArrayLike | bool | None = ...) -> tuple: ...
450450
@overload
451-
def __call__(self, value: ArrayLike, structured_output: Literal[False], clip: ArrayLike | bool | None = ...) -> tuple: ...
451+
def __call__(self, values: ArrayLike, structured_output: Literal[False], clip: ArrayLike | bool | None = ...) -> tuple: ...
452452
@overload
453-
def __call__(self, value: ArrayLike, structured_output: Literal[True], clip: ArrayLike | bool | None = ...) -> np.ma.MaskedArray: ...
453+
def __call__(self, values: ArrayLike, structured_output: Literal[True], clip: ArrayLike | bool | None = ...) -> np.ma.MaskedArray: ...
454454
@overload
455-
def __call__(self, value: ArrayLike, clip: ArrayLike | bool | None = ..., structured_output: None = ...) -> ArrayLike: ...
456-
def inverse(self, value: ArrayLike) -> list: ... # type: ignore[override]
455+
def __call__(self, values: ArrayLike, clip: ArrayLike | bool | None = ..., structured_output: None = ...) -> ArrayLike: ...
456+
def inverse(self, values: ArrayLike) -> list: ... # type: ignore[override]
457457
def autoscale(self, A: ArrayLike) -> None: ...
458458
def autoscale_None(self, A: ArrayLike) -> None: ...
459459
def scaled(self) -> bool: ...

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy