diff --git a/lib/mpl_toolkits/mplot3d/art3d.py b/lib/mpl_toolkits/mplot3d/art3d.py index 0888853df37e..cf825dfa053a 100644 --- a/lib/mpl_toolkits/mplot3d/art3d.py +++ b/lib/mpl_toolkits/mplot3d/art3d.py @@ -800,7 +800,17 @@ def _maybe_depth_shade_and_sort_colors(self, color_array): ) if len(color_array) > 1: color_array = color_array[self._z_markers_idx] - return mcolors.to_rgba_array(color_array, self._alpha) + + if color_array.shape[1] == 3: # color_array is RGB instead of RGBA + return mcolors.to_rgba_array(color_array, self._alpha) + + converted_alphas = ( + color_array[:, 3] * self._alpha + if self._alpha is not None + else color_array[:, 3] + ) + + return mcolors.to_rgba_array(color_array, converted_alphas) def get_facecolor(self): return self._maybe_depth_shade_and_sort_colors(super().get_facecolor())