<h3 dir="auto">Bug summary</h3>
<p dir="auto">When using plt.savefig() or plt.gcf().savefig() to save an active figure in EPS format, the resulting file is blank. The same commands produce the correct image when saving to PNG format. Error occurs in both Spyder and Jupyter Notebooks.</p>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
import matplotlib.pyplot as plt

plt.figure()
plt.plot(1,1,'x')
plt.savefig('test.png', fmt='png')
plt.savefig('test.eps', fmt='eps')"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<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">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">1</span>,<span class="pl-s">'x'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'test.png'</span>, <span class="pl-s1">fmt</span><span class="pl-c1">=</span><span class="pl-s">'png'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'test.eps'</span>, <span class="pl-s1">fmt</span><span class="pl-c1">=</span><span class="pl-s">'eps'</span>)</pre></div>
<h3 dir="auto">Actual outcome</h3>
<p dir="auto">PNG file:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/56979209/214295963-ec8e2862-51a0-4fca-9632-605a39e1fec9.png"><img src="https://user-images.githubusercontent.com/56979209/214295963-ec8e2862-51a0-4fca-9632-605a39e1fec9.png" alt="test" style="max-width: 100%;"></a></p>
<p dir="auto">The EPS file cannot be uploaded, but is just a white rectangle of the same dimensions as the PNG.</p>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">EPS file should look identical to the PNG.</p>
<h3 dir="auto">Additional information</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Operating system</h3>
<p dir="auto">OSX Ventura 13.1</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.5.1</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto">module://matplotlib_inline.backend_inline</p>
<h3 dir="auto">Python version</h3>
<p dir="auto">3.10.4</p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto">3.3.4</p>
<h3 dir="auto">Installation</h3>
<p dir="auto">conda</p>
<h3 dir="auto">Bug summary</h3>
<p dir="auto">Setting 'figure.autolayout' to 'True' removes most of the EPS savefig.</p>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt

plt.rcParams['figure.autolayout'] = 'True'

plt.plot([1, 2, 3], [1, 2, 3], 'o-')
plt.title(r'$\sum_{i=0}^{\infty} x_i$ just a test')
plt.savefig('test2.eps', format='eps')"><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">plt</span>.<span class="pl-s1">rcParams</span>[<span class="pl-s">'figure.autolayout'</span>] <span class="pl-c1">=</span> <span class="pl-s">'True'</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-s">'o-'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">title</span>(<span class="pl-s">r'$\sum_{i=0}^{\infty} x_i$ just a test'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'test2.eps'</span>, <span class="pl-s1">format</span><span class="pl-c1">=</span><span class="pl-s">'eps'</span>)</pre></div>
<h3 dir="auto">Actual outcome</h3>
<p dir="auto">Actual image after being exported from gimp (300dpi)</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/30732244/145681524-ace8a931-20c2-4fd3-86f7-4421e003b902.jpeg"><img src="https://user-images.githubusercontent.com/30732244/145681524-ace8a931-20c2-4fd3-86f7-4421e003b902.jpeg" alt="actual" style="max-width: 100%;"></a></p>
<p dir="auto">This is the EPS file:<br>
<a href="https://we.tl/t-ka6aoUGxKm" rel="nofollow">https://we.tl/t-ka6aoUGxKm</a></p>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">Expect the image in ".eps" file like this.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/30732244/145681516-61387c50-b4d5-4e35-9658-12aab0383c7c.jpeg"><img src="https://user-images.githubusercontent.com/30732244/145681516-61387c50-b4d5-4e35-9658-12aab0383c7c.jpeg" alt="expected" style="max-width: 100%;"></a></p>
<p dir="auto">This is the EPS file:<br>
<a href="https://we.tl/t-Q7WBPMwDcy" rel="nofollow">https://we.tl/t-Q7WBPMwDcy</a></p>
<h3 dir="auto">Additional information</h3>
<p dir="auto">I found this bug by an accident while using a custom ".mplstyle" on Matplotlib 3.5.0<br>
Seems like this rcParam <code class="notranslate">['figure.autolayout'] = 'True'</code> destroys about 2/3 of the eps file.<br>
<code class="notranslate">plt.tightlayout()</code> seem to not affect the result, the bug happens only with this rcParam on the latest matplotlib version.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt

plt.plot([1, 2, 3], [1, 2, 3], 'o-')
plt.title(r'$\sum_{i=0}^{\infty} x_i$ just a test')
plt.savefig('test2.eps', format='eps')"><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">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-s">'o-'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">title</span>(<span class="pl-s">r'$\sum_{i=0}^{\infty} x_i$ just a test'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'test2.eps'</span>, <span class="pl-s1">format</span><span class="pl-c1">=</span><span class="pl-s">'eps'</span>)</pre></div>
<p dir="auto">This is the code for the expected outcome.</p>
<h3 dir="auto">Operating system</h3>
<p dir="auto">Windows</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">Bug present only on 3.5.0</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto">Qt5Agg</p>
<h3 dir="auto">Python version</h3>
<p dir="auto">Tested with 3.10 and 3.9</p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Installation</h3>
<p dir="auto">conda</p>