I’m trying to produce a vector graphics image with alpha blending, however, the two backends I tried do not work.
Specifically, the image has the right blending when doing pylab.show(), but savefig() produces an opaque output.
Here is sample code (for the SVG backend. PDF backend has the same problem):
import matplotlib
matplotlib.use(‘SVG’)
import matplotlib.pylab as pylab
pylab.scatter([1],[1],s=1000,c=‘g’,alpha=1.0)
pylab.scatter([1],[1],s=10,c=‘b’,alpha=0.2)
pylab.scatter([1],[1],s=100,c=‘r’,alpha=0.5)
pylab.savefig(‘foo.svg’)
I suspect a bug (my MPL version is ‘0.98pre’):
Using a text editor to manually change the svg file, replacing
“opacity: 1.0” with “opacity: 0.5” fixes the problem.
Thanks,
-sasha.