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

Function _check_1d

lib/matplotlib/cbook.py:1410–1422  ·  view source on GitHub ↗

Convert scalars to 1D arrays; pass-through arrays as is.

(x)

Source from the content-addressed store, hash-verified

1408
1409
1410def _check_1d(x):
1411 """Convert scalars to 1D arrays; pass-through arrays as is."""
1412 # Unpack in case of e.g. Pandas or xarray object
1413 x = _unpack_to_numpy(x)
1414 # plot requires `shape` and `ndim`. If passed an
1415 # object that doesn't provide them, then force to numpy array.
1416 # Note this will strip unit information.
1417 if (not hasattr(x, 'shape') or
1418 not hasattr(x, 'ndim') or
1419 len(x.shape) < 1):
1420 return np.atleast_1d(x)
1421 else:
1422 return x
1423
1424
1425def _reshape_2D(X, name):

Callers 2

_plot_argsMethod · 0.90
index_ofFunction · 0.85

Calls 1

_unpack_to_numpyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…