@@ -3242,13 +3242,13 @@ def __init__(self, norms, vmin=None, vmax=None, clip=False):
3242
3242
The constituent norms. The list must have a minimum length of 2.
3243
3243
vmin, vmax : float, None, or list of float or None
3244
3244
Limits of the constituent norms.
3245
- If a list, eacheach value is assigned toone of the constituent
3245
+ If a list, each value is assigned toeach of the constituent
3246
3246
norms. Single values are repeated to form a list of appropriate size.
3247
3247
3248
3248
clip : bool or list of bools, default: False
3249
3249
Determines the behavior for mapping values outside the range
3250
3250
``[vmin, vmax]`` for the constituent norms.
3251
- If a list, eacheach value is assigned toone of the constituent
3251
+ If a list, each value is assigned toeach of the constituent
3252
3252
norms. Single values are repeated to form a list of appropriate size.
3253
3253
3254
3254
"""
@@ -3263,6 +3263,10 @@ def __init__(self, norms, vmin=None, vmax=None, clip=False):
3263
3263
elif isinstance (n ,str ):
3264
3264
scale_cls = _get_scale_cls_from_str (n )
3265
3265
norms [i ]= mpl .colorizer ._auto_norm_from_scale (scale_cls )()
3266
+ elif not isinstance (n ,Normalize ):
3267
+ raise ValueError (
3268
+ "MultiNorm must be assigned multiple norms, where each norm "
3269
+ f"is of type `None` `str`, or `Normalize`, not{ type (n )} " )
3266
3270
3267
3271
# Convert the list of norms to a tuple to make it immutable.
3268
3272
# If there is a use case for swapping a single norm, we can add support for
@@ -3275,8 +3279,7 @@ def __init__(self, norms, vmin=None, vmax=None, clip=False):
3275
3279
self .vmax = vmax
3276
3280
self .clip = clip
3277
3281
3278
- self ._id_norms = [n .callbacks .connect ('changed' ,
3279
- self ._changed )for n in self ._norms ]
3282
+ [n .callbacks .connect ('changed' ,self ._changed )for n in self ._norms ]
3280
3283
3281
3284
@property
3282
3285
def n_input (self ):
@@ -3348,7 +3351,8 @@ def _changed(self):
3348
3351
def __call__ (self ,value ,clip = None ):
3349
3352
"""
3350
3353
Normalize the data and return the normalized data.
3351
- Each variate in the input is assigned to the a constituent norm.
3354
+
3355
+ Each variate in the input is assigned to the constituent norm.
3352
3356
3353
3357
Parameters
3354
3358
----------
@@ -3381,8 +3385,7 @@ def __call__(self, value, clip=None):
3381
3385
3382
3386
def inverse (self ,value ):
3383
3387
"""
3384
- Maps the normalized value (i.e., index in the colormap) back to image
3385
- data value.
3388
+ Map the normalized value (i.e., index in the colormap) back to image data value.
3386
3389
3387
3390
Parameters
3388
3391
----------
@@ -3449,7 +3452,7 @@ def _iterable_variates_in_data(data, n_input):
3449
3452
"""
3450
3453
if isinstance (data ,np .ndarray )and data .dtype .fields is not None :
3451
3454
data = [data [descriptor [0 ]]for descriptor in data .dtype .descr ]
3452
- if not len (data )= =n_input :
3455
+ if len (data )! =n_input :
3453
3456
raise ValueError ("The input to this `MultiNorm` must be of shape "
3454
3457
f"({ n_input } , ...), or have a data type with{ n_input } "
3455
3458
"fields." )
@@ -4100,9 +4103,11 @@ def _get_scale_cls_from_str(scale_as_str):
4100
4103
Returns the scale class from a string.
4101
4104
4102
4105
Used in the creation of norms from a string to ensure a reasonable error
4103
- in the case where an invalid string is used. This cannot use
4104
- `_api.check_getitem()`, because the norm keyword accepts arguments
4105
- other than strings.
4106
+ in the case where an invalid string is used. This would normally use
4107
+ `_api.check_getitem()`, which would produce the error
4108
+ > 'not_a_norm' is not a valid value for norm; supported values are
4109
+ > 'linear', 'log', 'symlog', 'asinh', 'logit', 'function', 'functionlog'
4110
+ which is misleading because the norm keyword also accepts `Normalize` objects.
4106
4111
4107
4112
Parameters
4108
4113
----------