Skip to content

Commit 99c8278

Browse files
committed
minor tweak to pyplot.savefig to ensure that if transparent=True
is passed to `savefig`, the patch colors are restored on the screen after saving.
1 parent 10f2b0e commit 99c8278

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/pyplot.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,9 @@ def draw():
563563
@docstring.copy_dedent(Figure.savefig)
564564
def savefig(*args, **kwargs):
565565
fig = gcf()
566-
return fig.savefig(*args, **kwargs)
566+
res = fig.savefig(*args, **kwargs)
567+
draw() # need this if 'transparent=True' to reset colors
568+
return res
567569

568570

569571
@docstring.copy_dedent(Figure.ginput)

0 commit comments

Comments
 (0)