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 7dfc0f0

Browse files
chiraagbaluksunden
authored andcommitted
Fix Issue 26821: [Bug]: ValueError: The truth value... when an ndarray is passed to the color kwarg of axes3d.scatter (matplotlib#26834)
* FIX: [Bug]: ValueError: The truth value... when an ndarray is passed to the color kwarg of axes3d.scatter * added smoke test to ensure no value error is thrown * fixed smoke test to use fig canvas draw rather than plt show * added an extra line and reduced line length to comply with flake8 * removed trailing whitespace * Update lib/mpl_toolkits/mplot3d/tests/test_axes3d.py Co-authored-by: Kyle Sunden <git@ksunden.space> --------- Co-authored-by: Kyle Sunden <git@ksunden.space>
1 parent 48daa99 commit 7dfc0f0

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
@@ -2672,7 +2672,7 @@ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True,
26722672
xs, ys, zs, s, c, color = cbook.delete_masked_points(
26732673
xs, ys, zs, s, c, kwargs.get('color', None)
26742674
)
2675-
if kwargs.get('color', None):
2675+
if kwargs.get("color") isnotNone:
26762676
kwargs['color'] = color
26772677

26782678
# 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
@@ -2302,3 +2302,12 @@ def test_Poly3DCollection_init_value_error():
23022302
'or both for shade to work.'):
23032303
poly = np.array([[0, 0, 1], [0, 1, 1], [0, 0, 0]], float)
23042304
c = art3d.Poly3DCollection([poly], shade=True)
2305+
2306+
2307+
def test_ndarray_color_kwargs_value_error():
2308+
# smoke test
2309+
# ensures ndarray can be passed to color in kwargs for 3d projection plot
2310+
fig = plt.figure()
2311+
ax = fig.add_subplot(111, projection='3d')
2312+
ax.scatter(1, 0, 0, color=np.array([0, 0, 0, 1]))
2313+
fig.canvas.draw()

0 commit comments

Comments
(0)

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