Bug summary
I had this code some years ago to changes the dot color in the legend of a scatter plot:
legend = plt.gca().get_legend()
legend.legendHandles[0].set_color(plt.cm.viridis(.5))
I have to redo these old figs, and after changing legendHandles to the new legend_handles, I find myself unable to change the facecolor. Neither set_facecolor, set_color, set(facecolor=<>) or set(color=<>) work.
Code for reproduction
import matplotlib.pyplot as plt
plt.scatter([0,1],[0,1],c=[0,1],label='test')
plt.colorbar()
plt.legend()
legend = plt.gca().get_legend()
legend.legend_handles[0].set(color=plt.cm.viridis(.5))
plt.show()
Actual outcome
Only the edge color is changed (or nothing if using facecolor).

Expected outcome
Face color should be changed.
Additional information
It worked in 2022 (not sure of the matplotlib version back then).
Operating system
Arch
Matplotlib Version
3.11.0
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
Linux package manager
Bug summary
I had this code some years ago to changes the dot color in the legend of a scatter plot:
I have to redo these old figs, and after changing
legendHandlesto the newlegend_handles, I find myself unable to change thefacecolor. Neitherset_facecolor,set_color,set(facecolor=<>)orset(color=<>)work.Code for reproduction
Actual outcome
Only the edge color is changed (or nothing if using

facecolor).Expected outcome
Face color should be changed.
Additional information
It worked in 2022 (not sure of the matplotlib version back then).
Operating system
Arch
Matplotlib Version
3.11.0
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
Linux package manager