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 6cf6cbb

Browse filesBrowse files
committed
Merge pull request #1695 from tacaswell/alpha_kwarg_fix
Alpha kwarg fix
2 parents 7f55b23 + 842a164 commit 6cf6cbb
Copy full SHA for 6cf6cbb

File tree

Expand file treeCollapse file tree

8 files changed

+862
-304
lines changed
Filter options
Expand file treeCollapse file tree

8 files changed

+862
-304
lines changed

‎lib/matplotlib/lines.py

Copy file name to clipboardExpand all lines: lib/matplotlib/lines.py
+18-8Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def contains(self, mouseevent):
267267
# the math involved in checking for containment (here and inside of segment_hits) assumes
268268
# that it is OK to overflow. In case the application has set the error flags such that
269269
# an exception is raised on overflow, we temporarily set the appropriate error flags here
270-
# and set them back when we are finished.
270+
# and set them back when we are finished.
271271
olderrflags = np.seterr(all='ignore')
272272
try:
273273
# Check for collision
@@ -448,7 +448,7 @@ def recache(self, always=False):
448448
def _transform_path(self, subslice=None):
449449
"""
450450
Puts a TransformedPath instance at self._transformed_path,
451-
all invalidation of the transform is then handled by the
451+
all invalidation of the transform is then handled by the
452452
TransformedPath instance.
453453
"""
454454
# Masked arrays are now handled by the Path class itself
@@ -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
@@ -540,7 +543,7 @@ def draw(self, renderer):
540543
else:
541544
gc.set_foreground(edgecolor)
542545
gc.set_linewidth(self._markeredgewidth)
543-
gc.set_alpha(self._alpha)
546+
544547
marker = self._marker
545548
tpath, affine = transformed_path.get_transformed_points_and_affine()
546549
if len(tpath.vertices):
@@ -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':
@@ -970,9 +972,17 @@ def _get_rgba_face(self, alt=False):
970972
if is_string_like(facecolor) and facecolor.lower() == 'none':
971973
rgbaFace = None
972974
else:
973-
rgbaFace = colorConverter.to_rgba(facecolor)
975+
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'
Binary file not shown.
Loading

‎lib/matplotlib/tests/baseline_images/test_axes/test_alpha.svg

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/baseline_images/test_axes/test_alpha.svg
+817Lines changed: 817 additions & 0 deletions
Loading
Binary file not shown.
Binary file not shown.

‎lib/matplotlib/tests/baseline_images/test_axes/translucent_markers.svg

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/baseline_images/test_axes/translucent_markers.svg
-289Lines changed: 0 additions & 289 deletions
This file was deleted.

0 commit comments

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