Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5619fd9

Browse files
chiraagbalumeeseeksmachine
authored andcommitted
Backport PR matplotlib#26834: Fix Issue 26821: [Bug]: ValueError: The truth value... when an ndarray is passed to the color kwarg of axes3d.scatter
1 parent b4077ef commit 5619fd9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

‎lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2374,7 +2374,7 @@ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True,
23742374
xs, ys, zs, s, c, color = cbook.delete_masked_points(
23752375
xs, ys, zs, s, c, kwargs.get('color', None)
23762376
)
2377-
if kwargs.get('color', None):
2377+
if kwargs.get("color") isnotNone:
23782378
kwargs['color'] = color
23792379

23802380
# For xs and ys, 2D scatter() will do the copying.

‎lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,3 +2270,12 @@ def test_Poly3DCollection_init_value_error():
22702270
'or both for shade to work.'):
22712271
poly = np.array([[0, 0, 1], [0, 1, 1], [0, 0, 0]], float)
22722272
c = art3d.Poly3DCollection([poly], shade=True)
2273+
2274+
2275+
def test_ndarray_color_kwargs_value_error():
2276+
# smoke test
2277+
# ensures ndarray can be passed to color in kwargs for 3d projection plot
2278+
fig = plt.figure()
2279+
ax = fig.add_subplot(111, projection='3d')
2280+
ax.scatter(1, 0, 0, color=np.array([0, 0, 0, 1]))
2281+
fig.canvas.draw()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /