Skip to content

Commit c60f8b4

Browse files
committed
Fix issue with 2d scatter arguments
1 parent d3e1e78 commit c60f8b4

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
@@ -1042,6 +1042,13 @@ def scatter_wrapper(
10421042
markeredgecolor=markeredgecolor, markeredgecolors=markeredgecolors,
10431043
)
10441044

1045+
# Fix 2D arguments but still support scatter(x_vector, y_2d) usage
1046+
# NOTE: Since we are flattening vectors the coordinate metadata is meaningless,
1047+
# so converting to ndarray and stripping metadata is no problem.
1048+
# NOTE: numpy.ravel() preserves masked arrays
1049+
if len(args) == 2 and all(np.asarray(arg).squeeze().ndim > 1 for arg in args):
1050+
args = tuple(np.ravel(arg) for arg in args)
1051+
10451052
# Scale s array
10461053
if np.iterable(s) and (smin is not None or smax is not None):
10471054
smin_true, smax_true = min(s), max(s)

0 commit comments

Comments
 (0)