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

Method __call__

lib/matplotlib/colors.py:2934–2953  ·  view source on GitHub ↗
(self, value, clip=None)

Source from the content-addressed store, hash-verified

2932 *bound_init_signature.parameters.values()])
2933
2934 def __call__(self, value, clip=None):
2935 value, is_scalar = self.process_value(value)
2936 if self.vmin is None or self.vmax is None:
2937 self.autoscale_None(value)
2938 if self.vmin > self.vmax:
2939 raise ValueError("vmin must be less or equal to vmax")
2940 if self.vmin == self.vmax:
2941 return np.full_like(value, 0)
2942 if clip is None:
2943 clip = self.clip
2944 if clip:
2945 value = np.clip(value, self.vmin, self.vmax)
2946 t_value = self._trf.transform(value).reshape(np.shape(value))
2947 t_vmin, t_vmax = self._trf.transform([self.vmin, self.vmax])
2948 if not np.isfinite([t_vmin, t_vmax]).all():
2949 raise ValueError("Invalid vmin or vmax")
2950 t_value -= t_vmin
2951 t_value /= (t_vmax - t_vmin)
2952 t_value = np.ma.masked_invalid(t_value, copy=False)
2953 return t_value[0] if is_scalar else t_value
2954
2955 def inverse(self, value):
2956 if not self.scaled():

Callers

nothing calls this directly

Calls 5

autoscale_NoneMethod · 0.95
process_valueMethod · 0.80
clipMethod · 0.45
transformMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected