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

Method __call__

lib/matplotlib/colors.py:2686–2702  ·  view source on GitHub ↗

Map value to the interval [0, 1]. The *clip* argument is unused.

(self, value, clip=None)

Source from the content-addressed store, hash-verified

2684 self.vmax = self.vcenter + (self.vcenter - self.vmin)
2685
2686 def __call__(self, value, clip=None):
2687 """
2688 Map value to the interval [0, 1]. The *clip* argument is unused.
2689 """
2690 result, is_scalar = self.process_value(value)
2691 self.autoscale_None(result) # sets self.vmin, self.vmax if None
2692
2693 if not self.vmin <= self.vcenter <= self.vmax:
2694 raise ValueError("vmin, vcenter, vmax must increase monotonically")
2695 # note that we must extrapolate for tick locators:
2696 result = np.ma.masked_array(
2697 np.interp(result, [self.vmin, self.vcenter, self.vmax],
2698 [0, 0.5, 1], left=-np.inf, right=np.inf),
2699 mask=np.ma.getmask(result))
2700 if is_scalar:
2701 result = np.atleast_1d(result)[0]
2702 return result
2703
2704 def inverse(self, value):
2705 if not self.scaled():

Callers

nothing calls this directly

Calls 2

autoscale_NoneMethod · 0.95
process_valueMethod · 0.80

Tested by

no test coverage detected