Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0c20b5c

Browse filesBrowse files
tacaswellThomas A Caswell
authored andcommitted
changed how draw handles alpha in markerfacecolor so that the set
value respected.
1 parent a665710 commit 0c20b5c
Copy full SHA for 0c20b5c

File tree

Expand file treeCollapse file tree

1 file changed

+15
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-5
lines changed

‎lib/matplotlib/lines.py

Copy file name to clipboardExpand all lines: lib/matplotlib/lines.py
+15-5Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -531,12 +531,12 @@ def draw(self, renderer):
531531
if self._marker:
532532
gc = renderer.new_gc()
533533
self._set_gc_clip(gc)
534-
rgbFace = self._get_rgb_face()
535-
rgbFaceAlt = self._get_rgb_face(alt=True)
534+
rgbaFace = self._get_rgba_face()
535+
rgbaFaceAlt = self._get_rgba_face(alt=True)
536536
edgecolor = self.get_markeredgecolor()
537537
if is_string_like(edgecolor) and edgecolor.lower() == 'none':
538538
gc.set_linewidth(0)
539-
gc.set_foreground(rgbFace)
539+
gc.set_foreground(rgbaFace)
540540
else:
541541
gc.set_foreground(edgecolor)
542542
gc.set_linewidth(self._markeredgewidth)
@@ -574,16 +574,18 @@ def draw(self, renderer):
574574
marker_trans = marker_trans.scale(w)
575575
else:
576576
gc.set_linewidth(0)
577+
gc.set_alpha(rgbaFace[3])
577578
renderer.draw_markers(
578579
gc, marker_path, marker_trans, subsampled, affine.frozen(),
579-
rgbFace)
580+
rgbaFace)
580581
alt_marker_path = marker.get_alt_path()
581582
if alt_marker_path:
583+
gc.set_alpha(rgbaFaceAlt[3])
582584
alt_marker_trans = marker.get_alt_transform()
583585
alt_marker_trans = alt_marker_trans.scale(w)
584586
renderer.draw_markers(
585587
gc, alt_marker_path, alt_marker_trans, subsampled,
586-
affine.frozen(), rgbFaceAlt)
588+
affine.frozen(), rgbaFaceAlt)
587589

588590
gc.restore()
589591

@@ -961,6 +963,14 @@ def _get_rgb_face(self, alt=False):
961963
rgbFace = colorConverter.to_rgb(facecolor)
962964
return rgbFace
963965

966+
def _get_rgba_face(self, alt=False):
967+
facecolor = self._get_markerfacecolor(alt=alt)
968+
if is_string_like(facecolor) and facecolor.lower()=='none':
969+
rgbaFace = None
970+
else:
971+
rgbaFace = colorConverter.to_rgba(facecolor)
972+
return rgbaFace
973+
964974
# some aliases....
965975
def set_aa(self, val):
966976
'alias for set_antialiased'

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.