Matplotlib - savefig ignores facecolor when saving with transparency












0














I was surprised to find that when I use savefig with transparent=True this removed the facecolor which I might have set.



How can I not lose any background colours I manually set (including white)?



Compare



The GUI



enter image description here



Using transparent=False



plt.savefig('temp.pdf', format='pdf', transparent=False, bbox_inches='tight')


enter image description here



Using transparent=True



plt.savefig('temp.pdf', format='pdf', transparent=True, bbox_inches='tight')


enter image description here



MWE



import matplotlib as mpl

rc_fonts = {
"text.usetex": True,
'text.latex.preview': True,
"font.size": 50,
'mathtext.default': 'regular',
'axes.titlesize': 55,
"axes.labelsize": 55,
"legend.fontsize": 50,
"xtick.labelsize": 50,
"ytick.labelsize": 50,
'figure.titlesize': 55,
'figure.figsize': (10, 6.5), # 15, 9.3
'text.latex.preamble': [
r"""usepackage{lmodern,amsmath,amssymb,bm,physics,mathtools,nicefrac,letltxmacro,fixcmex}
"""],
"font.family": "serif",
"font.serif": "computer modern roman",
}
mpl.rcParams.update(rc_fonts)
import matplotlib.pylab as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes, InsetPosition, mark_inset
from numpy import linspace, sin


x = linspace(0, 1, 100)
plt.clf()
ax1 = plt.gca()
ax2 = plt.axes([0, 0, 1, 1], label=str(2))
ip = InsetPosition(ax1, [0.08, 0.63, 0.45, 0.3])
ax2.set_axes_locator(ip)
ax1.plot(x, x)
ax1.plot(x, x + 0.3)
ax1.set_xlim(0, 1)
ax1.set_ylim(0, 1)
plt.setp(ax2.get_xticklabels(), backgroundcolor="white")
ax2.set_facecolor('grey')
ax1.set_yticks()
ax1.set_xticks()
ax2.set_yticks()
ax1.text(0.3, 0.3, '$1$', transform=ax1.transAxes, horizontalalignment='center', verticalalignment='center', color='black', backgroundcolor='white')


Desired output



I would like it so that any background colurs default to None (or similar), such that if it is unspecified, then it will be transparent, and if it is specified, then it will be respected and opaque. Hence I would like the following output (using a blue background for added clarity):



What I would like:



enter image description here



Currently if I use facecolor=(1,1,1,0) it correctly removes all the colours around the margins, but the main plot area is still white.










share|improve this question
























  • Transparent, by definition, sets all axes backgrounds to transparent - hence the name. Why do you want to use it in the first place?
    – ImportanceOfBeingErnest
    Nov 22 at 19:37










  • A few of my figures go on posters or websites with a coloured background, and it looks nicer if the background colour matches. (Albeit I then have to be a bit more weary about filling in any background colours, if any).
    – oliversm
    Nov 22 at 19:47










  • But on a poster you would want the figure background transparent, not the axes, right? Or should the main axes be transparent as well? I have an open issue about the savefig arguments being misleading; but there is a workaround for any case. If this does not become obvious from reading the issue, I could give an answer here, if you tell what elements should be transparent or removed and which not. Also how are you preparing the poster? Via tex? Or a graphics program?
    – ImportanceOfBeingErnest
    Nov 22 at 19:59










  • @ImportanceOfBeingErnest --- I have added an example of the desired output which hopefully makes this clearer (I think I am a bit confused about the figure/axis/plot areas). Your open issue has helped me get some of the way there, but not all. The poster is prepared using LaTeX, although for websites I would just output an appropriate image format that allows transparency.
    – oliversm
    Nov 23 at 12:27


















0














I was surprised to find that when I use savefig with transparent=True this removed the facecolor which I might have set.



How can I not lose any background colours I manually set (including white)?



Compare



The GUI



enter image description here



Using transparent=False



plt.savefig('temp.pdf', format='pdf', transparent=False, bbox_inches='tight')


enter image description here



Using transparent=True



plt.savefig('temp.pdf', format='pdf', transparent=True, bbox_inches='tight')


enter image description here



MWE



import matplotlib as mpl

rc_fonts = {
"text.usetex": True,
'text.latex.preview': True,
"font.size": 50,
'mathtext.default': 'regular',
'axes.titlesize': 55,
"axes.labelsize": 55,
"legend.fontsize": 50,
"xtick.labelsize": 50,
"ytick.labelsize": 50,
'figure.titlesize': 55,
'figure.figsize': (10, 6.5), # 15, 9.3
'text.latex.preamble': [
r"""usepackage{lmodern,amsmath,amssymb,bm,physics,mathtools,nicefrac,letltxmacro,fixcmex}
"""],
"font.family": "serif",
"font.serif": "computer modern roman",
}
mpl.rcParams.update(rc_fonts)
import matplotlib.pylab as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes, InsetPosition, mark_inset
from numpy import linspace, sin


x = linspace(0, 1, 100)
plt.clf()
ax1 = plt.gca()
ax2 = plt.axes([0, 0, 1, 1], label=str(2))
ip = InsetPosition(ax1, [0.08, 0.63, 0.45, 0.3])
ax2.set_axes_locator(ip)
ax1.plot(x, x)
ax1.plot(x, x + 0.3)
ax1.set_xlim(0, 1)
ax1.set_ylim(0, 1)
plt.setp(ax2.get_xticklabels(), backgroundcolor="white")
ax2.set_facecolor('grey')
ax1.set_yticks()
ax1.set_xticks()
ax2.set_yticks()
ax1.text(0.3, 0.3, '$1$', transform=ax1.transAxes, horizontalalignment='center', verticalalignment='center', color='black', backgroundcolor='white')


Desired output



I would like it so that any background colurs default to None (or similar), such that if it is unspecified, then it will be transparent, and if it is specified, then it will be respected and opaque. Hence I would like the following output (using a blue background for added clarity):



What I would like:



enter image description here



Currently if I use facecolor=(1,1,1,0) it correctly removes all the colours around the margins, but the main plot area is still white.










share|improve this question
























  • Transparent, by definition, sets all axes backgrounds to transparent - hence the name. Why do you want to use it in the first place?
    – ImportanceOfBeingErnest
    Nov 22 at 19:37










  • A few of my figures go on posters or websites with a coloured background, and it looks nicer if the background colour matches. (Albeit I then have to be a bit more weary about filling in any background colours, if any).
    – oliversm
    Nov 22 at 19:47










  • But on a poster you would want the figure background transparent, not the axes, right? Or should the main axes be transparent as well? I have an open issue about the savefig arguments being misleading; but there is a workaround for any case. If this does not become obvious from reading the issue, I could give an answer here, if you tell what elements should be transparent or removed and which not. Also how are you preparing the poster? Via tex? Or a graphics program?
    – ImportanceOfBeingErnest
    Nov 22 at 19:59










  • @ImportanceOfBeingErnest --- I have added an example of the desired output which hopefully makes this clearer (I think I am a bit confused about the figure/axis/plot areas). Your open issue has helped me get some of the way there, but not all. The poster is prepared using LaTeX, although for websites I would just output an appropriate image format that allows transparency.
    – oliversm
    Nov 23 at 12:27
















0












0








0







I was surprised to find that when I use savefig with transparent=True this removed the facecolor which I might have set.



How can I not lose any background colours I manually set (including white)?



Compare



The GUI



enter image description here



Using transparent=False



plt.savefig('temp.pdf', format='pdf', transparent=False, bbox_inches='tight')


enter image description here



Using transparent=True



plt.savefig('temp.pdf', format='pdf', transparent=True, bbox_inches='tight')


enter image description here



MWE



import matplotlib as mpl

rc_fonts = {
"text.usetex": True,
'text.latex.preview': True,
"font.size": 50,
'mathtext.default': 'regular',
'axes.titlesize': 55,
"axes.labelsize": 55,
"legend.fontsize": 50,
"xtick.labelsize": 50,
"ytick.labelsize": 50,
'figure.titlesize': 55,
'figure.figsize': (10, 6.5), # 15, 9.3
'text.latex.preamble': [
r"""usepackage{lmodern,amsmath,amssymb,bm,physics,mathtools,nicefrac,letltxmacro,fixcmex}
"""],
"font.family": "serif",
"font.serif": "computer modern roman",
}
mpl.rcParams.update(rc_fonts)
import matplotlib.pylab as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes, InsetPosition, mark_inset
from numpy import linspace, sin


x = linspace(0, 1, 100)
plt.clf()
ax1 = plt.gca()
ax2 = plt.axes([0, 0, 1, 1], label=str(2))
ip = InsetPosition(ax1, [0.08, 0.63, 0.45, 0.3])
ax2.set_axes_locator(ip)
ax1.plot(x, x)
ax1.plot(x, x + 0.3)
ax1.set_xlim(0, 1)
ax1.set_ylim(0, 1)
plt.setp(ax2.get_xticklabels(), backgroundcolor="white")
ax2.set_facecolor('grey')
ax1.set_yticks()
ax1.set_xticks()
ax2.set_yticks()
ax1.text(0.3, 0.3, '$1$', transform=ax1.transAxes, horizontalalignment='center', verticalalignment='center', color='black', backgroundcolor='white')


Desired output



I would like it so that any background colurs default to None (or similar), such that if it is unspecified, then it will be transparent, and if it is specified, then it will be respected and opaque. Hence I would like the following output (using a blue background for added clarity):



What I would like:



enter image description here



Currently if I use facecolor=(1,1,1,0) it correctly removes all the colours around the margins, but the main plot area is still white.










share|improve this question















I was surprised to find that when I use savefig with transparent=True this removed the facecolor which I might have set.



How can I not lose any background colours I manually set (including white)?



Compare



The GUI



enter image description here



Using transparent=False



plt.savefig('temp.pdf', format='pdf', transparent=False, bbox_inches='tight')


enter image description here



Using transparent=True



plt.savefig('temp.pdf', format='pdf', transparent=True, bbox_inches='tight')


enter image description here



MWE



import matplotlib as mpl

rc_fonts = {
"text.usetex": True,
'text.latex.preview': True,
"font.size": 50,
'mathtext.default': 'regular',
'axes.titlesize': 55,
"axes.labelsize": 55,
"legend.fontsize": 50,
"xtick.labelsize": 50,
"ytick.labelsize": 50,
'figure.titlesize': 55,
'figure.figsize': (10, 6.5), # 15, 9.3
'text.latex.preamble': [
r"""usepackage{lmodern,amsmath,amssymb,bm,physics,mathtools,nicefrac,letltxmacro,fixcmex}
"""],
"font.family": "serif",
"font.serif": "computer modern roman",
}
mpl.rcParams.update(rc_fonts)
import matplotlib.pylab as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes, InsetPosition, mark_inset
from numpy import linspace, sin


x = linspace(0, 1, 100)
plt.clf()
ax1 = plt.gca()
ax2 = plt.axes([0, 0, 1, 1], label=str(2))
ip = InsetPosition(ax1, [0.08, 0.63, 0.45, 0.3])
ax2.set_axes_locator(ip)
ax1.plot(x, x)
ax1.plot(x, x + 0.3)
ax1.set_xlim(0, 1)
ax1.set_ylim(0, 1)
plt.setp(ax2.get_xticklabels(), backgroundcolor="white")
ax2.set_facecolor('grey')
ax1.set_yticks()
ax1.set_xticks()
ax2.set_yticks()
ax1.text(0.3, 0.3, '$1$', transform=ax1.transAxes, horizontalalignment='center', verticalalignment='center', color='black', backgroundcolor='white')


Desired output



I would like it so that any background colurs default to None (or similar), such that if it is unspecified, then it will be transparent, and if it is specified, then it will be respected and opaque. Hence I would like the following output (using a blue background for added clarity):



What I would like:



enter image description here



Currently if I use facecolor=(1,1,1,0) it correctly removes all the colours around the margins, but the main plot area is still white.







python matplotlib background






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 at 12:25

























asked Nov 22 at 17:38









oliversm

3331521




3331521












  • Transparent, by definition, sets all axes backgrounds to transparent - hence the name. Why do you want to use it in the first place?
    – ImportanceOfBeingErnest
    Nov 22 at 19:37










  • A few of my figures go on posters or websites with a coloured background, and it looks nicer if the background colour matches. (Albeit I then have to be a bit more weary about filling in any background colours, if any).
    – oliversm
    Nov 22 at 19:47










  • But on a poster you would want the figure background transparent, not the axes, right? Or should the main axes be transparent as well? I have an open issue about the savefig arguments being misleading; but there is a workaround for any case. If this does not become obvious from reading the issue, I could give an answer here, if you tell what elements should be transparent or removed and which not. Also how are you preparing the poster? Via tex? Or a graphics program?
    – ImportanceOfBeingErnest
    Nov 22 at 19:59










  • @ImportanceOfBeingErnest --- I have added an example of the desired output which hopefully makes this clearer (I think I am a bit confused about the figure/axis/plot areas). Your open issue has helped me get some of the way there, but not all. The poster is prepared using LaTeX, although for websites I would just output an appropriate image format that allows transparency.
    – oliversm
    Nov 23 at 12:27




















  • Transparent, by definition, sets all axes backgrounds to transparent - hence the name. Why do you want to use it in the first place?
    – ImportanceOfBeingErnest
    Nov 22 at 19:37










  • A few of my figures go on posters or websites with a coloured background, and it looks nicer if the background colour matches. (Albeit I then have to be a bit more weary about filling in any background colours, if any).
    – oliversm
    Nov 22 at 19:47










  • But on a poster you would want the figure background transparent, not the axes, right? Or should the main axes be transparent as well? I have an open issue about the savefig arguments being misleading; but there is a workaround for any case. If this does not become obvious from reading the issue, I could give an answer here, if you tell what elements should be transparent or removed and which not. Also how are you preparing the poster? Via tex? Or a graphics program?
    – ImportanceOfBeingErnest
    Nov 22 at 19:59










  • @ImportanceOfBeingErnest --- I have added an example of the desired output which hopefully makes this clearer (I think I am a bit confused about the figure/axis/plot areas). Your open issue has helped me get some of the way there, but not all. The poster is prepared using LaTeX, although for websites I would just output an appropriate image format that allows transparency.
    – oliversm
    Nov 23 at 12:27


















Transparent, by definition, sets all axes backgrounds to transparent - hence the name. Why do you want to use it in the first place?
– ImportanceOfBeingErnest
Nov 22 at 19:37




Transparent, by definition, sets all axes backgrounds to transparent - hence the name. Why do you want to use it in the first place?
– ImportanceOfBeingErnest
Nov 22 at 19:37












A few of my figures go on posters or websites with a coloured background, and it looks nicer if the background colour matches. (Albeit I then have to be a bit more weary about filling in any background colours, if any).
– oliversm
Nov 22 at 19:47




A few of my figures go on posters or websites with a coloured background, and it looks nicer if the background colour matches. (Albeit I then have to be a bit more weary about filling in any background colours, if any).
– oliversm
Nov 22 at 19:47












But on a poster you would want the figure background transparent, not the axes, right? Or should the main axes be transparent as well? I have an open issue about the savefig arguments being misleading; but there is a workaround for any case. If this does not become obvious from reading the issue, I could give an answer here, if you tell what elements should be transparent or removed and which not. Also how are you preparing the poster? Via tex? Or a graphics program?
– ImportanceOfBeingErnest
Nov 22 at 19:59




But on a poster you would want the figure background transparent, not the axes, right? Or should the main axes be transparent as well? I have an open issue about the savefig arguments being misleading; but there is a workaround for any case. If this does not become obvious from reading the issue, I could give an answer here, if you tell what elements should be transparent or removed and which not. Also how are you preparing the poster? Via tex? Or a graphics program?
– ImportanceOfBeingErnest
Nov 22 at 19:59












@ImportanceOfBeingErnest --- I have added an example of the desired output which hopefully makes this clearer (I think I am a bit confused about the figure/axis/plot areas). Your open issue has helped me get some of the way there, but not all. The poster is prepared using LaTeX, although for websites I would just output an appropriate image format that allows transparency.
– oliversm
Nov 23 at 12:27






@ImportanceOfBeingErnest --- I have added an example of the desired output which hopefully makes this clearer (I think I am a bit confused about the figure/axis/plot areas). Your open issue has helped me get some of the way there, but not all. The poster is prepared using LaTeX, although for websites I would just output an appropriate image format that allows transparency.
– oliversm
Nov 23 at 12:27














1 Answer
1






active

oldest

votes


















1














It looks like you can achive the desired output via



ax1.set_facecolor((1,1,1,0))
ax2.set_facecolor("grey")
fig.savefig(__file__+".pdf", facecolor=(1,1,1,0))





share|improve this answer























  • This doesn't achieve the desired affect. If I place these four lines at the end (and have a leading fig = plt.gcf() after the call to plt.clf()), then I get the main figure as still having a white and non-transparent background.
    – oliversm
    Nov 23 at 14:31










  • Right, I confused myself, and you as well, sorry about that. Now the code in the answer should work.
    – ImportanceOfBeingErnest
    Nov 23 at 23:35










  • So in your opinion is this behaviour to be expected or not, and well documented or not? I realise you comment about frameon in your linked issue being misleading. Having to set all these facecolor values seems a little bit messy. If I followed your issue correctly this does seem like the job of frameon.
    – oliversm
    Nov 24 at 0:41










  • Yes. So I would like to change this behaviour, but I haven't put any effort into it yet. There is also a little controversity about whether to remove all the arguments to savefig, to which I would oppose.
    – ImportanceOfBeingErnest
    Nov 24 at 0:57











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435979%2fmatplotlib-savefig-ignores-facecolor-when-saving-with-transparency%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














It looks like you can achive the desired output via



ax1.set_facecolor((1,1,1,0))
ax2.set_facecolor("grey")
fig.savefig(__file__+".pdf", facecolor=(1,1,1,0))





share|improve this answer























  • This doesn't achieve the desired affect. If I place these four lines at the end (and have a leading fig = plt.gcf() after the call to plt.clf()), then I get the main figure as still having a white and non-transparent background.
    – oliversm
    Nov 23 at 14:31










  • Right, I confused myself, and you as well, sorry about that. Now the code in the answer should work.
    – ImportanceOfBeingErnest
    Nov 23 at 23:35










  • So in your opinion is this behaviour to be expected or not, and well documented or not? I realise you comment about frameon in your linked issue being misleading. Having to set all these facecolor values seems a little bit messy. If I followed your issue correctly this does seem like the job of frameon.
    – oliversm
    Nov 24 at 0:41










  • Yes. So I would like to change this behaviour, but I haven't put any effort into it yet. There is also a little controversity about whether to remove all the arguments to savefig, to which I would oppose.
    – ImportanceOfBeingErnest
    Nov 24 at 0:57
















1














It looks like you can achive the desired output via



ax1.set_facecolor((1,1,1,0))
ax2.set_facecolor("grey")
fig.savefig(__file__+".pdf", facecolor=(1,1,1,0))





share|improve this answer























  • This doesn't achieve the desired affect. If I place these four lines at the end (and have a leading fig = plt.gcf() after the call to plt.clf()), then I get the main figure as still having a white and non-transparent background.
    – oliversm
    Nov 23 at 14:31










  • Right, I confused myself, and you as well, sorry about that. Now the code in the answer should work.
    – ImportanceOfBeingErnest
    Nov 23 at 23:35










  • So in your opinion is this behaviour to be expected or not, and well documented or not? I realise you comment about frameon in your linked issue being misleading. Having to set all these facecolor values seems a little bit messy. If I followed your issue correctly this does seem like the job of frameon.
    – oliversm
    Nov 24 at 0:41










  • Yes. So I would like to change this behaviour, but I haven't put any effort into it yet. There is also a little controversity about whether to remove all the arguments to savefig, to which I would oppose.
    – ImportanceOfBeingErnest
    Nov 24 at 0:57














1












1








1






It looks like you can achive the desired output via



ax1.set_facecolor((1,1,1,0))
ax2.set_facecolor("grey")
fig.savefig(__file__+".pdf", facecolor=(1,1,1,0))





share|improve this answer














It looks like you can achive the desired output via



ax1.set_facecolor((1,1,1,0))
ax2.set_facecolor("grey")
fig.savefig(__file__+".pdf", facecolor=(1,1,1,0))






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 23 at 23:35

























answered Nov 23 at 12:49









ImportanceOfBeingErnest

125k10127204




125k10127204












  • This doesn't achieve the desired affect. If I place these four lines at the end (and have a leading fig = plt.gcf() after the call to plt.clf()), then I get the main figure as still having a white and non-transparent background.
    – oliversm
    Nov 23 at 14:31










  • Right, I confused myself, and you as well, sorry about that. Now the code in the answer should work.
    – ImportanceOfBeingErnest
    Nov 23 at 23:35










  • So in your opinion is this behaviour to be expected or not, and well documented or not? I realise you comment about frameon in your linked issue being misleading. Having to set all these facecolor values seems a little bit messy. If I followed your issue correctly this does seem like the job of frameon.
    – oliversm
    Nov 24 at 0:41










  • Yes. So I would like to change this behaviour, but I haven't put any effort into it yet. There is also a little controversity about whether to remove all the arguments to savefig, to which I would oppose.
    – ImportanceOfBeingErnest
    Nov 24 at 0:57


















  • This doesn't achieve the desired affect. If I place these four lines at the end (and have a leading fig = plt.gcf() after the call to plt.clf()), then I get the main figure as still having a white and non-transparent background.
    – oliversm
    Nov 23 at 14:31










  • Right, I confused myself, and you as well, sorry about that. Now the code in the answer should work.
    – ImportanceOfBeingErnest
    Nov 23 at 23:35










  • So in your opinion is this behaviour to be expected or not, and well documented or not? I realise you comment about frameon in your linked issue being misleading. Having to set all these facecolor values seems a little bit messy. If I followed your issue correctly this does seem like the job of frameon.
    – oliversm
    Nov 24 at 0:41










  • Yes. So I would like to change this behaviour, but I haven't put any effort into it yet. There is also a little controversity about whether to remove all the arguments to savefig, to which I would oppose.
    – ImportanceOfBeingErnest
    Nov 24 at 0:57
















This doesn't achieve the desired affect. If I place these four lines at the end (and have a leading fig = plt.gcf() after the call to plt.clf()), then I get the main figure as still having a white and non-transparent background.
– oliversm
Nov 23 at 14:31




This doesn't achieve the desired affect. If I place these four lines at the end (and have a leading fig = plt.gcf() after the call to plt.clf()), then I get the main figure as still having a white and non-transparent background.
– oliversm
Nov 23 at 14:31












Right, I confused myself, and you as well, sorry about that. Now the code in the answer should work.
– ImportanceOfBeingErnest
Nov 23 at 23:35




Right, I confused myself, and you as well, sorry about that. Now the code in the answer should work.
– ImportanceOfBeingErnest
Nov 23 at 23:35












So in your opinion is this behaviour to be expected or not, and well documented or not? I realise you comment about frameon in your linked issue being misleading. Having to set all these facecolor values seems a little bit messy. If I followed your issue correctly this does seem like the job of frameon.
– oliversm
Nov 24 at 0:41




So in your opinion is this behaviour to be expected or not, and well documented or not? I realise you comment about frameon in your linked issue being misleading. Having to set all these facecolor values seems a little bit messy. If I followed your issue correctly this does seem like the job of frameon.
– oliversm
Nov 24 at 0:41












Yes. So I would like to change this behaviour, but I haven't put any effort into it yet. There is also a little controversity about whether to remove all the arguments to savefig, to which I would oppose.
– ImportanceOfBeingErnest
Nov 24 at 0:57




Yes. So I would like to change this behaviour, but I haven't put any effort into it yet. There is also a little controversity about whether to remove all the arguments to savefig, to which I would oppose.
– ImportanceOfBeingErnest
Nov 24 at 0:57


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435979%2fmatplotlib-savefig-ignores-facecolor-when-saving-with-transparency%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

What visual should I use to simply compare current year value vs last year in Power BI desktop

Alexandru Averescu

Trompette piccolo