8000 Merge pull request #8954 from tacaswell/fix_scatter_alpha · matplotlib/matplotlib@3b3278e · GitHub
[go: up one dir, main page]

Skip to content

Commit 3b3278e

Browse files
authored
Merge pull request #8954 from tacaswell/fix_scatter_alpha
Fix scatter alpha
2 parents 06e389f + 2bcbe5b commit 3b3278e

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

lib/matplotlib/collections.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ def set_alpha(self, alpha):
711711
float(alpha)
712712
except TypeError:
713713
raise TypeError('alpha must be a float or None')
714+
self.update_dict['array'] = True
714715
artist.Artist.set_alpha(self, alpha)
715716
self._set_facecolor(self._original_facecolor)
716717
self._set_edgecolor(self._original_edgecolor)
Loading

lib/matplotlib/tests/test_collections.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,3 +624,14 @@ def test_lslw_bcast():
624624
col.set_linestyles(['-', '-', '-'])
625625
assert_equal(col.get_linestyles(), [(None, None)] * 3)
626626
assert_equal(col.get_linewidths(), [1, 2, 3])
627+
628+
629+
@image_comparison(baseline_images=['scatter_post_alpha'],
630+
extensions=['png'], remove_text=True,
631+
style='default')
632+
def test_scatter_post_alpha():
633+
fig, ax = plt.subplots()
634+
sc = ax.scatter(range(5), range(5), c=range(5))
635+
# this needs to be here to update internal state
636+
fig.canvas.draw()
637+
sc.set_alpha(.1)

0 commit comments

Comments
 (0)
0