Skip to content

Commit 6b86d63

Browse files
committed
updates based on feedback from @timhoffm
1 parent aeeba89 commit 6b86d63

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

lib/matplotlib/colors.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3226,16 +3226,16 @@ def inverse(self, value):
32263226

32273227
class MultiNorm(Normalize):
32283228
"""
3229-
A mixin class which contains multiple scalar norms
3229+
A class which contains multiple scalar norms
32303230
"""
32313231

32323232
def __init__(self, norms, vmin=None, vmax=None, clip=False):
32333233
"""
32343234
Parameters
32353235
----------
3236-
norms : List of (str, `Normalize` or None)
3236+
norms : list of (str, `Normalize` or None)
32373237
The constituent norms. The list must have a minimum length of 2.
3238-
vmin, vmax : float, None, or list of float or None
3238+
vmin, vmax : float or None or list of (float or None)
32393239
Limits of the constituent norms.
32403240
If a list, each value is assigned to each of the constituent
32413241
norms. Single values are repeated to form a list of appropriate size.
@@ -3279,14 +3279,17 @@ def __init__(self, norms, vmin=None, vmax=None, clip=False):
32793279

32803280
@property
32813281
def n_variables(self):
3282+
"""Number of norms held by this `MultiNorm`."""
32823283
return len(self._norms)
32833284

32843285
@property
32853286
def norms(self):
3287+
"""The individual norms held but this `MultiNorm`"""
32863288
return self._norms
32873289

32883290
@property
32893291
def vmin(self):
3292+
"""The lower limit of each constituent norm."""
32903293
return tuple(n.vmin for n in self._norms)
32913294

32923295
@vmin.setter
@@ -3300,6 +3303,7 @@ def vmin(self, value):
33003303

33013304
@property
33023305
def vmax(self):
3306+
"""The upper limit of each constituent norm."""
33033307
return tuple(n.vmax for n in self._norms)
33043308

33053309
@vmax.setter
@@ -3313,6 +3317,7 @@ def vmax(self, value):
33133317

33143318
@property
33153319
def clip(self):
3320+
"""The clip behaviour of each constituent norm."""
33163321
return tuple(n.clip for n in self._norms)
33173322

33183323
@clip.setter
@@ -3339,17 +3344,17 @@ def __call__(self, value, clip=None):
33393344
33403345
Parameters
33413346
----------
3342-
value
3343-
Data to normalize. Must be of length `n_variables` or have a data type with
3344-
`n_variables` fields.
3347+
value : array-like
3348+
Data to normalize. Must be of length `n_variables` or be a structured
3349+
array or scalar with `n_variables` fields.
33453350
clip : list of bools or bool, optional
33463351
See the description of the parameter *clip* in Normalize.
33473352
If ``None``, defaults to ``self.clip`` (which defaults to
33483353
``False``).
33493354
33503355
Returns
33513356
-------
3352-
List
3357+
list
33533358
Normalized input values as a list of length `n_variables`
33543359
33553360
Notes
@@ -3373,8 +3378,8 @@ def inverse(self, value):
33733378
Parameters
33743379
----------
33753380
value
3376-
Normalized value. Must be of length `n_variables` or have a data type with
3377-
`n_variables` fields.
3381+
Normalized value. Must be of length `n_variables` or be a structured array
3382+
or scalar with `n_variables` fields.
33783383
"""
33793384
value = self._iterable_variates_in_data(value, self.n_variables)
33803385
result = [n.inverse(v) for n, v in zip(self.norms, value)]
@@ -3401,8 +3406,8 @@ def autoscale_None(self, A):
34013406
Parameters
34023407
----------
34033408
A
3404-
Data, must be of length `n_variables` or have a data type with
3405-
`n_variables` fields.
3409+
Data, must be of length `n_variables` or be a structured array or scalar
3410+
with `n_variables` fields.
34063411
"""
34073412
with self.callbacks.blocked():
34083413
A = self._iterable_variates_in_data(A, self.n_variables)
@@ -3411,7 +3416,7 @@ def autoscale_None(self, A):
34113416
self._changed()
34123417

34133418
def scaled(self):
3414-
"""Return whether both *vmin* and *vmax* are set on all constituent norms"""
3419+
"""Return whether both *vmin* and *vmax* are set on all constituent norms."""
34153420
return all([n.scaled() for n in self.norms])
34163421

34173422
@staticmethod
@@ -3437,8 +3442,8 @@ def _iterable_variates_in_data(data, n_variables):
34373442
data = [data[descriptor[0]] for descriptor in data.dtype.descr]
34383443
if len(data) != n_variables:
34393444
raise ValueError("The input to this `MultiNorm` must be of shape "
3440-
f"({n_variables}, ...), or have a data type with "
3441-
f"{n_variables} fields.")
3445+
f"({n_variables}, ...), or be structured array or scalar "
3446+
f"with {n_variables} fields.")
34423447
return data
34433448

34443449

0 commit comments

Comments
 (0)