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:
Activity
[-]scatter, set_facecolors is not working on Axes3D[/-][+]scatter - set_facecolors is not working on Axes3D[/+]afvincent commentedon Nov 9, 2017
@orena1 Thank you for the report :).
I can confirm that the dots were already blue since at least Matplotlib 1.5.3. (they probably never turned red...)
Here is a smaller MWE, with a possible workaround for the moment (though I am not 100% sure why it works):
Attn @WeatherGod
tacaswell commentedon Nov 13, 2017
Moved to 2.2 as this is not a regression.
17 remaining items