Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit393c862

Browse files
committed
Merge pull request#11105 from anntzer/markerfacecolor-none-alpha
FIX: When drawing markers, don't set the GraphicsContext alpha.Conflicts:lib/matplotlib/lines.py - keep aliases (which are implemented automatically on master) explicitly in code
1 parent278ee47 commit393c862

File tree

6 files changed

+667
-638
lines changed

6 files changed

+667
-638
lines changed

‎lib/matplotlib/backends/backend_ps.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,10 @@ def draw_markers(
537537
ps_cmd= ['/o {','gsave','newpath','translate']# don't want the translate to be global
538538

539539
lw=gc.get_linewidth()
540-
stroke=lw!=0.0
540+
alpha= (gc.get_alpha()
541+
ifgc.get_forced_alpha()orlen(gc.get_rgb())==3
542+
elsegc.get_rgb()[3])
543+
stroke=lw>0andalpha>0
541544
ifstroke:
542545
ps_cmd.append('%.1f setlinewidth'%lw)
543546
jint=gc.get_joinstyle()

‎lib/matplotlib/lines.py

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -758,9 +758,8 @@ def draw(self, renderer):
758758
gc=renderer.new_gc()
759759
self._set_gc_clip(gc)
760760

761-
ln_color_rgba=self._get_rgba_ln_color()
762-
gc.set_foreground(ln_color_rgba,isRGBA=True)
763-
gc.set_alpha(ln_color_rgba[3])
761+
lc_rgba=mcolors.to_rgba(self._color,self._alpha)
762+
gc.set_foreground(lc_rgba,isRGBA=True)
764763

765764
gc.set_antialiased(self._antialiased)
766765
gc.set_linewidth(self._linewidth)
@@ -784,24 +783,23 @@ def draw(self, renderer):
784783
ifself._markerandself._markersize>0:
785784
gc=renderer.new_gc()
786785
self._set_gc_clip(gc)
787-
rgbaFace=self._get_rgba_face()
788-
rgbaFaceAlt=self._get_rgba_face(alt=True)
789-
edgecolor=self.get_markeredgecolor()
790-
ifcbook._str_lower_equal(edgecolor,"none"):
791-
gc.set_linewidth(0)
792-
gc.set_foreground(rgbaFace,isRGBA=True)
793-
else:
794-
gc.set_foreground(edgecolor)
795-
gc.set_linewidth(self._markeredgewidth)
796-
mec=self._markeredgecolor
797-
if (cbook._str_equal(mec,"auto")
798-
andnotcbook._str_lower_equal(
799-
self.get_markerfacecolor(),"none")):
800-
gc.set_alpha(rgbaFace[3])
801-
else:
802-
gc.set_alpha(self.get_alpha())
786+
gc.set_linewidth(self._markeredgewidth)
803787
gc.set_antialiased(self._antialiased)
804788

789+
ec_rgba=mcolors.to_rgba(
790+
self.get_markeredgecolor(),self._alpha)
791+
fc_rgba=mcolors.to_rgba(
792+
self._get_markerfacecolor(),self._alpha)
793+
fcalt_rgba=mcolors.to_rgba(
794+
self._get_markerfacecolor(alt=True),self._alpha)
795+
# If the edgecolor is "auto", it is set according to the *line*
796+
# color but inherits the alpha value of the *face* color, if any.
797+
if (cbook._str_equal(self._markeredgecolor,"auto")
798+
andnotcbook._str_lower_equal(
799+
self.get_markerfacecolor(),"none")):
800+
ec_rgba=ec_rgba[:3]+ (fc_rgba[3],)
801+
gc.set_foreground(ec_rgba,isRGBA=True)
802+
805803
marker=self._marker
806804
tpath,affine=transf_path.get_transformed_points_and_affine()
807805
iflen(tpath.vertices):
@@ -831,22 +829,15 @@ def draw(self, renderer):
831829

832830
renderer.draw_markers(gc,marker_path,marker_trans,
833831
subsampled,affine.frozen(),
834-
rgbaFace)
832+
fc_rgba)
835833

836834
alt_marker_path=marker.get_alt_path()
837835
ifalt_marker_path:
838836
alt_marker_trans=marker.get_alt_transform()
839837
alt_marker_trans=alt_marker_trans.scale(w)
840-
if (cbook._str_equal(mec,"auto")
841-
andnotcbook._str_lower_equal(
842-
self.get_markerfacecoloralt(),"none")):
843-
gc.set_alpha(rgbaFaceAlt[3])
844-
else:
845-
gc.set_alpha(self.get_alpha())
846-
847838
renderer.draw_markers(
848839
gc,alt_marker_path,alt_marker_trans,subsampled,
849-
affine.frozen(),rgbaFaceAlt)
840+
affine.frozen(),fcalt_rgba)
850841

851842
gc.restore()
852843

@@ -891,8 +882,7 @@ def _get_markerfacecolor(self, alt=False):
891882
fc=self._markerfacecoloralt
892883
else:
893884
fc=self._markerfacecolor
894-
895-
if (isinstance(fc,six.string_types)andfc.lower()=='auto'):
885+
ifcbook._str_lower_equal(fc,'auto'):
896886
ifself.get_fillstyle()=='none':
897887
return'none'
898888
else:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp