<p dir="auto">The figure background color is not respected by <code class="notranslate">savefig()</code>. MWE:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt

fig = plt.figure()
plt.plot([1, 2, 3], [1, 2, 3])

plt.gca().set_facecolor('#2d2d2d')
plt.gcf().patch.set_facecolor('#2d2d2d')

# plt.show()
plt.savefig(&quot;out.png&quot;)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>

<span class="pl-s1">fig</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">figure</span>()
<span class="pl-s1">plt</span>.<span class="pl-en">plot</span>([<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>], [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>])

<span class="pl-s1">plt</span>.<span class="pl-en">gca</span>().<span class="pl-en">set_facecolor</span>(<span class="pl-s">'#2d2d2d'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">gcf</span>().<span class="pl-s1">patch</span>.<span class="pl-en">set_facecolor</span>(<span class="pl-s">'#2d2d2d'</span>)

<span class="pl-c"># plt.show()</span>
<span class="pl-s1">plt</span>.<span class="pl-en">savefig</span>(<span class="pl-s">"out.png"</span>)</pre></div>
<p dir="auto">show():<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/181628/80948584-b49cd300-8df2-11ea-8c29-ba7b096c4f63.png"><img src="https://user-images.githubusercontent.com/181628/80948584-b49cd300-8df2-11ea-8c29-ba7b096c4f63.png" alt="out1" style="max-width: 100%;"></a></p>
<p dir="auto">savefig():<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/181628/80948592-b8c8f080-8df2-11ea-998a-c3e69e065e7c.png"><img src="https://user-images.githubusercontent.com/181628/80948592-b8c8f080-8df2-11ea-998a-c3e69e065e7c.png" alt="out" style="max-width: 100%;"></a></p>
<p dir="auto">I find the current handling of background colors very non-intuitive:</p>
<ol dir="auto">
<li>figure <code class="notranslate">facecolor</code> is not applied for <code class="notranslate">savefig()</code> by default</li>
<li>figure <code class="notranslate">facecolor</code> is not applied setting <code class="notranslate">frameon=False</code></li>
<li><code class="notranslate">axis_bgcolor</code> is not applied when hiding axis lines/ticks via <code class="notranslate">axis('off')</code></li>
</ol>
<p dir="auto">So using a white plain surface to draw objects needs the following code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="fig = figure(..., facecolor='w', edgecolor='None')
ax.axis('equal')        # equal scale
ax.axis('off')          # do not show axis
ax.axis([-1, 1, -1, 1]) # scale to unit lengths
show()
fig.savefig(..., facecolor=fig.get_facecolor(), edgecolor='None', transparent=True)"><pre class="notranslate"><code class="notranslate">fig = figure(..., facecolor='w', edgecolor='None')
ax.axis('equal')        # equal scale
ax.axis('off')          # do not show axis
ax.axis([-1, 1, -1, 1]) # scale to unit lengths
show()
fig.savefig(..., facecolor=fig.get_facecolor(), edgecolor='None', transparent=True)
</code></pre></div>
<p dir="auto">My suggestion</p>
<ul dir="auto">
<li>apply same colors to <code class="notranslate">savefig()</code> by default</li>
<li>mention in the docs of <code class="notranslate">axis_bgcolor</code> and <code class="notranslate">axis('off')</code> that this setting is ignored</li>
<li>mention in the docs of <code class="notranslate">facecolor</code> and <code class="notranslate">frameon</code> that this setting is ignored</li>
</ul>