Skip to content

Commit 11b4302

Browse files
authored
Merge pull request #154 from lukelbd/fix-2d-scatter
Fix issue with 2d scatter arguments
2 parents 4c27753 + c60f8b4 commit 11b4302

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

proplot/wrappers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,13 @@ def scatter_wrapper(
10491049
markeredgecolor=markeredgecolor, markeredgecolors=markeredgecolors,
10501050
)
10511051

1052+
# Fix 2D arguments but still support scatter(x_vector, y_2d) usage
1053+
# NOTE: Since we are flattening vectors the coordinate metadata is meaningless,
1054+
# so converting to ndarray and stripping metadata is no problem.
1055+
# NOTE: numpy.ravel() preserves masked arrays
1056+
if len(args) == 2 and all(np.asarray(arg).squeeze().ndim > 1 for arg in args):
1057+
args = tuple(np.ravel(arg) for arg in args)
1058+
10521059
# Scale s array
10531060
if np.iterable(s) and (smin is not None or smax is not None):
10541061
smin_true, smax_true = min(s), max(s)

0 commit comments

Comments
 (0)