fixed bug with incorrect alpha values being produced
@@ -226,7 +226,12 @@ def qsave(layout: 'Layout', filename: str, *,
ctx.current_layout.set_colors(bg, fg)
out = MatplotlibBackend(ax)
Frontend(ctx, out).draw_layout(layout, finalize=True)
- fig.savefig(filename, dpi=dpi, facecolor=ax.get_facecolor())
+ # transparent=True sets the axes color to fully transparent
+ # facecolor sets the figure color
+ # (semi-)transparent axes colors do not produce transparent outputs
+ # but (semi-)transparent figure colors do.
+ fig.savefig(filename, dpi=dpi,
+ facecolor=ax.get_facecolor(), transparent=True)
plt.close(fig)
finally:
matplotlib.use(old_backend)
