Convert scalars to 1D arrays; pass-through arrays as is.
(x)
| 1408 | |
| 1409 | |
| 1410 | def _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 | |
| 1425 | def _reshape_2D(X, name): |
no test coverage detected
searching dependent graphs…