mpl_interactions.nearest_idx¶
-
mpl_interactions.
nearest_idx
(array, value, axis=None)¶ Return the index of the array that is closest to value. Equivalent to np.argmin(np.abs(array-value))
- Parameters
- arrayarraylike
- valueScalar
- axisint, optional
From np.argmin: “By default, the index is into the flattened array, otherwise along the specified axis.”
- Returns
- idxIndexArray
index of array that most closely matches value. If axis=None this will be an integer