Open
Description
Bug summary
If colors of scatter points are set during the initial call, then later calls of set_facecolor
to that artist fail to update the colors. set_edgecolor
works as expected. This is happening in 2D and 3D scatter plots (fixing the 2D case should fix both).
Code for reproduction
import matplotlib.pyplot as plt
import matplotlib as mpl
cmap = mpl.colormaps['viridis']
x = np.ones(10)
y = np.linspace(0, 1, 10)
fig, ax = plt.subplots()
scat = ax.scatter(x, y, c=y, cmap='viridis', s=20)
colors = cmap(np.roll(y, 3))
scat.set_edgecolor(colors)
scat.set_facecolor(colors)
Actual outcome
Expected outcome
Result if colors are not passed in the initial scatter call are as expected:
fig, ax = plt.subplots()
scat = ax.scatter(x, y, s=20)
colors = cmap(np.roll(y, 3))
scat.set_edgecolor(colors)
scat.set_facecolor(colors)
Additional information
No response
Operating system
No response
Matplotlib Version
latest main
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
git checkout
Metadata
Metadata
Assignees
Labels
No labels