The cairo backend ignores the alpha value of artists when rendering Collections such as PatchCollection.
Code for reproduction
import matplotlib matplotlib.use('Cairo') import matplotlib.pyplot as plt from matplotlib.collections import PatchCollection import numpy as np circles = [plt.Circle((i,i), 1.0) for i in np.arange(10)] col = PatchCollection(circles, alpha=0.5) ax = plt.gca() ax.add_collection(col) ax.autoscale_view() plt.savefig('test_cairo_alpha.png')
Actual outcome
Expected outcome Expected output when using the default Qt5Agg backend:
Matplotlib version
Cairo backend: Fix alpha render of collections
Thanks for #12774. As a curiosity: why are you using the cairo backend? Are you aware of my rewrite of that backend in https://github.com/anntzer/mplcairo?
I'm using the cairo backend via FigureCanvasGTK3Cairo to embed some plots in Gtk3. I was not aware of your rewrite of that backend, will check it out :) are there plans to merge your port to matplotlib master?
Not in the short term, as there are serious technical hurdles to doing that (mostly, the static linking of a recent c++ standard library).
Add test for matplotlib#12773
Activity
Cairo backend: Fix alpha render of collections
anntzer commented on Nov 12, 2018
Thanks for #12774.
As a curiosity: why are you using the cairo backend? Are you aware of my rewrite of that backend in https://github.com/anntzer/mplcairo?
joh commented on Nov 14, 2018
I'm using the cairo backend via FigureCanvasGTK3Cairo to embed some plots in Gtk3. I was not aware of your rewrite of that backend, will check it out :) are there plans to merge your port to matplotlib master?
anntzer commented on Nov 14, 2018
Not in the short term, as there are serious technical hurdles to doing that (mostly, the static linking of a recent c++ standard library).
Add test for matplotlib#12773
Cairo backend: Fix alpha render of collections
Cairo backend: Fix alpha render of collections
Cairo backend: Fix alpha render of collections