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

Method _errorevery_to_mask

lib/matplotlib/axes/_axes.py:3879–3908  ·  view source on GitHub ↗

Normalize `errorbar`'s *errorevery* to be a boolean mask for data *x*. This function is split out to be usable both by 2D and 3D errorbars.

(x, errorevery)

Source from the content-addressed store, hash-verified

3877
3878 @staticmethod
3879 def _errorevery_to_mask(x, errorevery):
3880 """
3881 Normalize `errorbar`'s *errorevery* to be a boolean mask for data *x*.
3882
3883 This function is split out to be usable both by 2D and 3D errorbars.
3884 """
3885 if isinstance(errorevery, Integral):
3886 errorevery = (0, errorevery)
3887 if isinstance(errorevery, tuple):
3888 if (len(errorevery) == 2 and
3889 isinstance(errorevery[0], Integral) and
3890 isinstance(errorevery[1], Integral)):
3891 errorevery = slice(errorevery[0], None, errorevery[1])
3892 else:
3893 raise ValueError(
3894 f'{errorevery=!r} is a not a tuple of two integers')
3895 elif isinstance(errorevery, slice):
3896 pass
3897 elif not isinstance(errorevery, str) and np.iterable(errorevery):
3898 try:
3899 x[errorevery] # fancy indexing
3900 except (ValueError, IndexError) as err:
3901 raise ValueError(
3902 f"{errorevery=!r} is iterable but not a valid NumPy fancy "
3903 "index to match 'xerr'/'yerr'") from err
3904 else:
3905 raise ValueError(f"{errorevery=!r} is not a recognized value")
3906 everymask = np.zeros(len(x), bool)
3907 everymask[errorevery] = True
3908 return everymask
3909
3910 @_api.make_keyword_only("3.10", "ecolor")
3911 @_preprocess_data(replace_names=["x", "y", "xerr", "yerr"],

Callers 2

errorbarMethod · 0.95
errorbarMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected