Issue 1:
Bug summary

Creating a scatter plot with a legend and setting the color of the legend markers only changes the edgecolor of the markers.

Code for reproduction

markers = ["+", "s", "o", "*"]

fig, ax = plt.subplots(figsize=figsize)

for i, marker in enumerate(markers):
data = np.random.randn(10, 3)
x, y, z = np.split(data, 3, axis=1)
ax.scatter(x, y, c=z, marker=marker, label=f"scatter {i}")

leg = ax.legend(loc="best")
for leg_handle in leg.legendHandles:
leg_handle.set_color("k")
# leg_handle.set_facecolor("k")
# leg_handle.set_edgecolor("k")

Actual outcome

set_color only changes the edgecolor of the marker instead of changing all colors.

set_facecolor has no effect.

set_edgecolor works as expected.

Expected outcome

set_color should change all colors of the marker.

set_facecolor should change the face color of the marker.

Additional information

No response

Operating system

Windows

Matplotlib Version

3.5.2

Matplotlib Backend

module://matplotlib_inline.backend_inline

Python version

3.10.4

Jupyter version

6.4.12

Installation

conda

Issue 2:
Bug report

Bug summary

When a PathCollection is created (e.g. by a scatter plot) using an array of scalars to be colormapped on it then the changed() method reverts the effect of previously issued set_facecolor command thus set_facecolor does not work as expected. (As a consequence set_color() deos not work as expected either.)

Code for reproduction

import matplotlib.pyplot as plt

def make_fig():
fig, ax = plt.subplots(1,2, figsize=(6,2))
sc0 = ax[0].scatter([0,0,1],[0,1,0], c=(1,2,3), linewidths=3, alpha=None)
ax[0].set_title('Colormapped scalar') # underlying ScalarMappable mixin is used
sc1 = ax[1].scatter([0,0,1],[0,1,0], c=['r','g','b'], linewidths=3, alpha=None)
ax[1].set_title('Indiv color definition')
return fig, ax, sc0, sc1

fig, ax, sc0, sc1 = make_fig()
sc0.set_facecolor([[1, 0, 0, 0.1],[1, 0, 0, 0.5],[1, 0, 0, 0.9]])
sc0.changed() # unexpected behavior here
sc1.set_facecolor([[1, 0, 0, 0.1],[1, 0, 0, 0.5],[1, 0, 0, 0.9]])
sc1.changed() # unexpected behavior here

Actual outcome

Expected outcome

The same shades of red shall appear on the left panel that are displayed on the right.

Note: without the changed() calls everything is OK. set_facecolor correctly changes both face and edge color and alpha for individual colors and for colormapped scalar too.

But then, the changed() method reverts all changes for colormapped scalars Most probably set_facecolor does not correctly update some property telling that new colors are not derived from scalar values anymore.

Additional nuissances

fig, ax, sc0, sc1 = make_fig()
sc0.set_color([[1, 0, 0, 0.1],[1, 0, 0, 0.5],[1, 0, 0, 0.9]])
sc0.changed()
sc1.set_color([[1, 0, 0, 0.1],[1, 0, 0, 0.5],[1, 0, 0, 0.9]])
sc1.changed()
# fig.canvas.draw_idle() # does not help

In the above settings, set_color changes both face and edge color together with alpha for individual colors and edge color together with alpha for colormapped scalar too.

But then, the changed() method reverts face color for colormapped scalars. Face color should not be reverted by calling changed().

Matplotlib version

Operating system: Windows

Matplotlib version: 3.0.2

Python version: 3.6.7 |Anaconda custom (64-bit)| (default, Dec 10 2018, 20:35:02) [MSC v.1915 64 bit (AMD64)]