Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 93cd39a

Browse files
committed
Fix alpha also for foreground color
1 parent 46467bb commit 93cd39a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/backends/backend_cairo.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,17 +303,22 @@ def _draw_paths():
303303
gc_vars, rgb_fc = reuse_key
304304
gc = copy.copy(gc0)
305305
# We actually need to call the setters to reset the internal state.
306+
vars(gc).update(gc_vars)
306307
for k, v in gc_vars.items():
307308
if k == "_linestyle": # Deprecated, no effect.
308309
continue
309310
elif k == "_dashes":
310311
gc.set_dashes(*v) # Needs to be unpacked.
312+
elif k == "_alpha": # Avoid touching forced_alpha
313+
if gc.get_forced_alpha():
314+
gc.set_alpha(v)
315+
elif k == "_rgb": # rgb -> set_foreground
316+
gc.set_foreground(v)
311317
else:
312318
try:
313319
getattr(gc, "set" + k)(v)
314320
except (AttributeError, TypeError) as e:
315321
pass
316-
vars(gc).update(gc_vars)
317322
gc.ctx.new_path()
318323
paths, transforms = zip(*grouped_draw)
319324
grouped_draw.clear()

0 commit comments

Comments
 (0)