-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
scatter - set_facecolors is not working on Axes3D #9725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@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): import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
plt.figure()
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="blue")
scat.set_facecolors("red")
# Possible workaround that seems to trigger
# the update of the facecolor values
scat.set_3d_properties(pos[:, 2], "y")
plt.show() Attn @WeatherGod |
Moved to 2.2 as this is not a regression. |
This is still an issue. Prior to finding this bug report I posted my own examples as a new bug report because the examples I found were all related to animation just like the context given here. Animation is not the cause. But, as pointed out in those examples, I believe the issue should be handled together with the issue of coexisting collection-level alpha value and alpha values coming from RGBA colors. |
Ran into this issue when updating color limits with Matplotlib version: Ubuntu 16.04, 3.3.0rc1+149.g8c2fbda, Qt5Agg backend, Python 3.7.6 |
@liuzhenqi77 Do you have a mininal example where it looks right on the screen but saving it comes out wrong? |
@tacaswell I tried more cases, and find that my case could be related to import numpy as np
import matplotlib.pyplot as plt
pos = np.random.uniform(0, 1, (10, 3))
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
scat = ax.scatter(pos[:, 0], pos[:, 1], pos[:, 2], c=range(10), cmap="Reds")
plt.colorbar(scat, ax=ax)
fig.savefig("test1.png")
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
scat = ax.scatter(pos[:, 0], pos[:, 1], pos[:, 2], c=range(10), cmap="Reds")
# plt.colorbar(scat, ax=ax)
fig.savefig("test2.png") My original user case was,
|
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
Matplotlib version
print(matplotlib.get_backend())
): MacOSXThe text was updated successfully, but these errors were encountered: