Skip to content

Commit 94fefd5

Browse files
sramesh750tacaswell
authored andcommitted
FIX: transpaent kwarg now only affects subfigure during printing
1 parent cc70a86 commit 94fefd5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/matplotlib/figure.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3061,9 +3061,15 @@ def savefig(self, fname, *, transparent=None, **kwargs):
30613061
if transparent:
30623062
kwargs.setdefault('facecolor', 'none')
30633063
kwargs.setdefault('edgecolor', 'none')
3064+
# set subfigure to appear transparent in printed image
30643065
for subfig in self.subfigs:
3065-
subfig.set_facecolor('none')
3066-
subfig.set_edgecolor('none')
3066+
stack.enter_context(
3067+
subfig.patch._cm_set(
3068+
facecolor='none', edgecolor='none'))
3069+
for subfig_ax in subfig.axes:
3070+
stack.enter_context(
3071+
subfig_ax.patch._cm_set(
3072+
facecolor='none', edgecolor='none'))
30673073
# set axes to be transparent
30683074
for ax in self.axes:
30693075
stack.enter_context(

0 commit comments

Comments
 (0)