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 edc48f0

Browse filesBrowse files
committed
updated the way the line color + alpha is handled to match how it is
done for markers. If a 4-tuple is passed in, the alpha from that will be used, with the kwarg alpha over-ridding it.
1 parent 17fa943 commit edc48f0
Copy full SHA for edc48f0

File tree

Expand file treeCollapse file tree

1 file changed

+14
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-4
lines changed

‎lib/matplotlib/lines.py

Copy file name to clipboardExpand all lines: lib/matplotlib/lines.py
+14-4Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def draw(self, renderer):
495495
x0, x1 = self.axes.get_xbound()
496496
i0, = self._x.searchsorted([x0], 'left')
497497
i1, = self._x.searchsorted([x1], 'right')
498-
subslice = slice(max(i0-1, 0), i1+1)
498+
subslice = slice(max(i0 - 1, 0), i1 + 1)
499499
self.ind_offset = subslice.start
500500
self._transform_path(subslice)
501501

@@ -505,10 +505,13 @@ def draw(self, renderer):
505505
gc = renderer.new_gc()
506506
self._set_gc_clip(gc)
507507

508-
gc.set_foreground(self._color)
508+
ln_color_rgba = self._get_rgba_ln_color()
509+
gc.set_foreground(ln_color_rgba)
510+
gc.set_alpha(ln_color_rgba[3])
511+
509512
gc.set_antialiased(self._antialiased)
510513
gc.set_linewidth(self._linewidth)
511-
gc.set_alpha(self._alpha)
514+
512515
if self.is_dashed():
513516
cap = self._dashcapstyle
514517
join = self._dashjoinstyle
@@ -956,7 +959,6 @@ def update_from(self, other):
956959
other._marker.get_fillstyle())
957960
self._drawstyle = other._drawstyle
958961

959-
960962
def _get_rgb_face(self, alt=False):
961963
facecolor = self._get_markerfacecolor(alt=alt)
962964
if is_string_like(facecolor) and facecolor.lower() == 'none':
@@ -973,6 +975,14 @@ def _get_rgba_face(self, alt=False):
973975
rgbaFace = colorConverter.to_rgba(facecolor, self._alpha)
974976
return rgbaFace
975977

978+
def _get_rgba_ln_color(self, alt=False):
979+
ln_color = self._color
980+
if is_string_like(ln_color) and ln_color.lower() == 'none':
981+
rgba_ln = None
982+
else:
983+
rgba_ln = colorConverter.to_rgba(ln_color, self._alpha)
984+
return rgba_ln
985+
976986
# some aliases....
977987
def set_aa(self, val):
978988
'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.