Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 67e69e9 commit cb5c84dCopy full SHA for cb5c84d
1 file changed
lib/matplotlib/backends/backend_agg.py
@@ -560,13 +560,11 @@ def print_to_buffer(self):
560
561
@_api.delete_parameter("3.5", "args")
562
def print_jpg(self, filename_or_obj, *args, pil_kwargs=None):
563
- # Remove transparency by alpha-blending on an assumed white background.
564
- r, g, b, a = mcolors.to_rgba(self.figure.get_facecolor())
565
- try:
566
- self.figure.set_facecolor(a * np.array([r, g, b]) + 1 - a)
+ # savefig() has already applied savefig.facecolor; we now set it to
+ # white to make imsave() blend semi-transparent figures against an
+ # assumed white background.
+ with mpl.rc_context({"savefig.facecolor": "white"}):
567
self._print_pil(filename_or_obj, "jpeg", pil_kwargs)
568
- finally:
569
- self.figure.set_facecolor((r, g, b, a))
570
571
print_jpeg = print_jpg
572
0 commit comments