Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 67da9ed

Browse files
committed
Merge pull request #3031 from jrjohansson/fix-axes3d-shade-color
avoid np.nan values in colors array returned by axes3d._shade_colors
2 parents 1472dfc + 1d8c18b commit 67da9ed

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,11 +1675,13 @@ def _shade_colors(self, color, normals):
16751675
'''
16761676

16771677
shade = np.array([np.dot(n / proj3d.mod(n), [-1, -1, 0.5])
1678+
if proj3d.mod(n) else np.nan
16781679
for n in normals])
16791680
mask = ~np.isnan(shade)
16801681

16811682
if len(shade[mask]) > 0:
16821683
norm = Normalize(min(shade[mask]), max(shade[mask]))
1684+
shade[~mask] = min(shade[mask])
16831685
color = colorConverter.to_rgba_array(color)
16841686
# shape of color should be (M, 4) (where M is number of faces)
16851687
# shape of shade should be (M,)

0 commit comments

Comments
 (0)