Closed
Description
Bug report
Bug summary
Trying to replicate this code: https://matplotlib.org/examples/animation/rain.html , but in Axes3D does not work, it seems that it is not possible to change the facecolors of the scatter while axes is 3D (it does work in 2d)
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import matplotlib.cm as cmx
from mpl_toolkits.mplot3d import Axes3D
plt.figure()
jet = cm = plt.get_cmap('jet')
cNorm = matplotlib.colors.Normalize(vmin=1, vmax=10)
scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=jet)
cells = 10
ax = plt.subplot(1,1,1, projection='3d')
pos = np.random.uniform(0, 1, (10, 3))
scat = ax.scatter(pos[:,0],pos[:,1],pos[:,2],
edgecolors=None,
facecolors= [scalarMap.to_rgba(1) for cond in range(10)])
scat.set_facecolors([scalarMap.to_rgba(10) for cond in range(10)])
plt.show()
##the dots should be red, but they are blue
Matplotlib version
- Operating system: MacOs
- Matplotlib version: 2.1.0
- Matplotlib backend (
print(matplotlib.get_backend())
): MacOSX - Python version: 2.7.14
- Jupyter version (if applicable):
- Other libraries: