MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / __init__

Method __init__

lib/matplotlib/colors.py:3349–3396  ·  view source on GitHub ↗

Parameters ---------- norms : list of (str or `Normalize`) The constituent norms. The list must have a minimum length of 1. vmin, vmax : None or list of (float or None) Limits of the constituent norms. If a list, one value is assig

(self, norms, vmin=None, vmax=None, clip=None)

Source from the content-addressed store, hash-verified

3347 """
3348
3349 def __init__(self, norms, vmin=None, vmax=None, clip=None):
3350 """
3351 Parameters
3352 ----------
3353 norms : list of (str or `Normalize`)
3354 The constituent norms. The list must have a minimum length of 1.
3355 vmin, vmax : None or list of (float or None)
3356 Limits of the constituent norms.
3357 If a list, one value is assigned to each of the constituent
3358 norms.
3359 If None, the limits of the constituent norms
3360 are not changed.
3361 clip : None or list of bools, default: None
3362 Determines the behavior for mapping values outside the range
3363 ``[vmin, vmax]`` for the constituent norms.
3364 If a list, each value is assigned to each of the constituent
3365 norms.
3366 If None, the behaviour of the constituent norms is not changed.
3367 """
3368 if cbook.is_scalar_or_string(norms):
3369 raise ValueError(
3370 "MultiNorm must be assigned an iterable of norms, where each "
3371 f"norm is of type `str`, or `Normalize`, not {type(norms)}")
3372
3373 if len(norms) < 1:
3374 raise ValueError("MultiNorm must be assigned at least one norm")
3375
3376 def resolve(norm):
3377 if isinstance(norm, str):
3378 scale_cls = _api.getitem_checked(scale._scale_mapping, norm=norm)
3379 return mpl.colorizer._auto_norm_from_scale(scale_cls)()
3380 elif isinstance(norm, Normalize):
3381 return norm
3382 else:
3383 raise ValueError(
3384 "Each norm assigned to MultiNorm must be "
3385 f"of type `str`, or `Normalize`, not {type(norm)}")
3386
3387 self._norms = tuple(resolve(norm) for norm in norms)
3388
3389 self.callbacks = cbook.CallbackRegistry(signals=["changed"])
3390
3391 self.vmin = vmin
3392 self.vmax = vmax
3393 self.clip = clip
3394
3395 for n in self._norms:
3396 n.callbacks.connect('changed', self._changed)
3397
3398 @property
3399 def n_components(self):

Callers

nothing calls this directly

Calls 1

connectMethod · 0.45

Tested by

no test coverage detected