<h3 dir="auto">Bug summary</h3>
<p dir="auto">Creating a scatter plot with a legend and setting the color of the legend markers only changes the edgecolor of the markers.</p>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="markers = [&quot;+&quot;, &quot;s&quot;, &quot;o&quot;, &quot;*&quot;]

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&quot;scatter {i}&quot;)

leg = ax.legend(loc=&quot;best&quot;)
for leg_handle in leg.legendHandles:
    leg_handle.set_color(&quot;k&quot;)
    # leg_handle.set_facecolor(&quot;k&quot;)
    # leg_handle.set_edgecolor(&quot;k&quot;)"><pre class="notranslate"><span class="pl-s1">markers</span> <span class="pl-c1">=</span> [<span class="pl-s">"+"</span>, <span class="pl-s">"s"</span>, <span class="pl-s">"o"</span>, <span class="pl-s">"*"</span>]

<span class="pl-s1">fig</span>, <span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>(<span class="pl-s1">figsize</span><span class="pl-c1">=</span><span class="pl-s1">figsize</span>)

<span class="pl-k">for</span> <span class="pl-s1">i</span>, <span class="pl-s1">marker</span> <span class="pl-c1">in</span> <span class="pl-en">enumerate</span>(<span class="pl-s1">markers</span>):
    <span class="pl-s1">data</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">10</span>, <span class="pl-c1">3</span>)
    <span class="pl-s1">x</span>, <span class="pl-s1">y</span>, <span class="pl-s1">z</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">split</span>(<span class="pl-s1">data</span>, <span class="pl-c1">3</span>, <span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">1</span>)
    <span class="pl-s1">ax</span>.<span class="pl-en">scatter</span>(<span class="pl-s1">x</span>, <span class="pl-s1">y</span>, <span class="pl-s1">c</span><span class="pl-c1">=</span><span class="pl-s1">z</span>, <span class="pl-s1">marker</span><span class="pl-c1">=</span><span class="pl-s1">marker</span>, <span class="pl-s1">label</span><span class="pl-c1">=</span><span class="pl-s">f"scatter <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">i</span><span class="pl-kos">}</span></span>"</span>)

<span class="pl-s1">leg</span> <span class="pl-c1">=</span> <span class="pl-s1">ax</span>.<span class="pl-en">legend</span>(<span class="pl-s1">loc</span><span class="pl-c1">=</span><span class="pl-s">"best"</span>)
<span class="pl-k">for</span> <span class="pl-s1">leg_handle</span> <span class="pl-c1">in</span> <span class="pl-s1">leg</span>.<span class="pl-s1">legendHandles</span>:
    <span class="pl-s1">leg_handle</span>.<span class="pl-en">set_color</span>(<span class="pl-s">"k"</span>)
    <span class="pl-c"># leg_handle.set_facecolor("k")</span>
    <span class="pl-c"># leg_handle.set_edgecolor("k")</span></pre></div>
<h3 dir="auto">Actual outcome</h3>
<p dir="auto">set_color only changes the edgecolor of the marker instead of changing all colors.<br>
set_facecolor has no effect.<br>
set_edgecolor works as expected.</p>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">set_color should change all colors of the marker.<br>
set_facecolor should change the face color of the marker.</p>
<h3 dir="auto">Additional information</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Operating system</h3>
<p dir="auto">Windows</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.5.2</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto">module://matplotlib_inline.backend_inline</p>
<h3 dir="auto">Python version</h3>
<p dir="auto">3.10.4</p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto">6.4.12</p>
<h3 dir="auto">Installation</h3>
<p dir="auto">conda</p>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">When a PathCollection is created (e.g. by a scatter plot) using an array of scalars to be colormapped on it then the <code class="notranslate">changed()</code> method reverts the effect of previously issued <code class="notranslate">set_facecolor</code> command thus <code class="notranslate">set_facecolor</code> does not work as expected. (As a consequence <code class="notranslate">set_color()</code> deos not work as expected either.)</p>
<p dir="auto"><strong>Code for reproduction</strong></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="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"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>

<span class="pl-k">def</span> <span class="pl-en">make_fig</span>():
    <span class="pl-s1">fig</span>, <span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>(<span class="pl-c1">1</span>,<span class="pl-c1">2</span>, <span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">6</span>,<span class="pl-c1">2</span>))
    <span class="pl-s1">sc0</span> <span class="pl-c1">=</span> <span class="pl-s1">ax</span>[<span class="pl-c1">0</span>].<span class="pl-en">scatter</span>([<span class="pl-c1">0</span>,<span class="pl-c1">0</span>,<span class="pl-c1">1</span>],[<span class="pl-c1">0</span>,<span class="pl-c1">1</span>,<span class="pl-c1">0</span>], <span class="pl-s1">c</span><span class="pl-c1">=</span>(<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>), <span class="pl-s1">linewidths</span><span class="pl-c1">=</span><span class="pl-c1">3</span>, <span class="pl-s1">alpha</span><span class="pl-c1">=</span><span class="pl-c1">None</span>)
    <span class="pl-s1">ax</span>[<span class="pl-c1">0</span>].<span class="pl-en">set_title</span>(<span class="pl-s">'Colormapped scalar'</span>)  <span class="pl-c"># underlying ScalarMappable mixin is used</span>
    <span class="pl-s1">sc1</span> <span class="pl-c1">=</span> <span class="pl-s1">ax</span>[<span class="pl-c1">1</span>].<span class="pl-en">scatter</span>([<span class="pl-c1">0</span>,<span class="pl-c1">0</span>,<span class="pl-c1">1</span>],[<span class="pl-c1">0</span>,<span class="pl-c1">1</span>,<span class="pl-c1">0</span>], <span class="pl-s1">c</span><span class="pl-c1">=</span>[<span class="pl-s">'r'</span>,<span class="pl-s">'g'</span>,<span class="pl-s">'b'</span>], <span class="pl-s1">linewidths</span><span class="pl-c1">=</span><span class="pl-c1">3</span>, <span class="pl-s1">alpha</span><span class="pl-c1">=</span><span class="pl-c1">None</span>)
    <span class="pl-s1">ax</span>[<span class="pl-c1">1</span>].<span class="pl-en">set_title</span>(<span class="pl-s">'Indiv color definition'</span>)
    <span class="pl-k">return</span> <span class="pl-s1">fig</span>, <span class="pl-s1">ax</span>, <span class="pl-s1">sc0</span>, <span class="pl-s1">sc1</span>

<span class="pl-s1">fig</span>, <span class="pl-s1">ax</span>, <span class="pl-s1">sc0</span>, <span class="pl-s1">sc1</span> <span class="pl-c1">=</span> <span class="pl-en">make_fig</span>()
<span class="pl-s1">sc0</span>.<span class="pl-en">set_facecolor</span>([[<span class="pl-c1">1</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0.1</span>],[<span class="pl-c1">1</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0.5</span>],[<span class="pl-c1">1</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0.9</span>]])
<span class="pl-s1">sc0</span>.<span class="pl-en">changed</span>()  <span class="pl-c"># unexpected behavior here</span>
<span class="pl-s1">sc1</span>.<span class="pl-en">set_facecolor</span>([[<span class="pl-c1">1</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0.1</span>],[<span class="pl-c1">1</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0.5</span>],[<span class="pl-c1">1</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0.9</span>]])
<span class="pl-s1">sc1</span>.<span class="pl-en">changed</span>()  <span class="pl-c"># unexpected behavior here</span></pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/19959788/50820550-4397f900-132d-11e9-8c9a-c2cab8f6fd15.png"><img src="https://user-images.githubusercontent.com/19959788/50820550-4397f900-132d-11e9-8c9a-c2cab8f6fd15.png" alt="mpl_color_bug1" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto">The same shades of red shall appear on the left panel that are displayed on the right.</p>
<p dir="auto"><strong>Note:</strong> without the <code class="notranslate">changed()</code> calls everything is OK. <code class="notranslate">set_facecolor</code> correctly changes both face and edge color and alpha for individual colors and for colormapped scalar too.<br>
But then, the <code class="notranslate">changed()</code> method reverts all changes for colormapped scalars Most probably <code class="notranslate">set_facecolor</code> does not correctly update some property telling that new colors are not derived from scalar values anymore.</p>
<p dir="auto"><strong>Additional nuissances</strong></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="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"><pre class="notranslate"><span class="pl-s1">fig</span>, <span class="pl-s1">ax</span>, <span class="pl-s1">sc0</span>, <span class="pl-s1">sc1</span> <span class="pl-c1">=</span> <span class="pl-en">make_fig</span>()
<span class="pl-s1">sc0</span>.<span class="pl-en">set_color</span>([[<span class="pl-c1">1</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0.1</span>],[<span class="pl-c1">1</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0.5</span>],[<span class="pl-c1">1</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0.9</span>]])
<span class="pl-s1">sc0</span>.<span class="pl-en">changed</span>()
<span class="pl-s1">sc1</span>.<span class="pl-en">set_color</span>([[<span class="pl-c1">1</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0.1</span>],[<span class="pl-c1">1</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0.5</span>],[<span class="pl-c1">1</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0</span>, <span class="pl-c1">0.9</span>]])
<span class="pl-s1">sc1</span>.<span class="pl-en">changed</span>()
<span class="pl-c"># fig.canvas.draw_idle()  # does not help</span></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/19959788/50820560-498dda00-132d-11e9-9400-e1bbab8c7816.png"><img src="https://user-images.githubusercontent.com/19959788/50820560-498dda00-132d-11e9-9400-e1bbab8c7816.png" alt="mpl_color_bug2" style="max-width: 100%;"></a></p>
<p dir="auto">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.<br>
But then, the <code class="notranslate">changed()</code> method reverts face color for colormapped scalars. Face color should not be reverted by calling <code class="notranslate">changed()</code>.</p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Windows</li>
<li>Matplotlib version: 3.0.2</li>
<li>Python version: 3.6.7 |Anaconda custom (64-bit)| (default, Dec 10 2018, 20:35:02) [MSC v.1915 64 bit (AMD64)]</li>
</ul>