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

Method _locate

lib/matplotlib/colorbar.py:1213–1231  ·  view source on GitHub ↗

Given a set of color data values, return their corresponding colorbar data coordinates.

(self, x)

Source from the content-addressed store, hash-verified

1211 self._set_scale('function', functions=funcs)
1212
1213 def _locate(self, x):
1214 """
1215 Given a set of color data values, return their
1216 corresponding colorbar data coordinates.
1217 """
1218 if isinstance(self.norm, (colors.NoNorm, colors.BoundaryNorm)):
1219 b = self._boundaries
1220 xn = x
1221 else:
1222 # Do calculations using normalized coordinates so
1223 # as to make the interpolation more accurate.
1224 b = self.norm(self._boundaries, clip=False).filled()
1225 xn = self.norm(x, clip=False).filled()
1226
1227 bunique = b[self._inside]
1228 yunique = self._y
1229
1230 z = np.interp(xn, bunique, yunique)
1231 return z
1232
1233 # trivial helpers
1234

Callers 1

add_linesMethod · 0.95

Calls 1

normMethod · 0.45

Tested by

no test coverage detected