<p dir="auto">I've upgraded to matplotlib 1.4.0 and am getting invalid EPS files (according to Preview) when I save figures that use</p>
<p dir="auto">basemap (1.0.7). The same figure in PNG or PDF format works fine. I also saved a bar chart in EPS that worked.</p>
<p dir="auto">I have verified that this happens in both OS X Mavericks and Mountain Lion. It doesn't matter whether I install using pip or homebrew. If I downgrade to matplotlib 1.3.1 it works fine.</p>
<p dir="auto">Below is the code I was trying:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt 
import numpy as np
from mpl_toolkits.basemap import Basemap

plt.figure()
m = Basemap(projection='npstere',lon_0=-270.,boundinglat=30.,round=True)
m.drawcoastlines(linewidth=1)
m.drawmapboundary(linewidth=1)
m.fillcontinents(color='silver')
m.drawmeridians(np.arange(-360,1,60))
m.drawparallels(np.arange(30,90,30))

plt.savefig('test.eps')
plt.savefig('test.pdf')
plt.savefig('test.png')"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>
<span class="pl-s1">matplotlib</span>.<span class="pl-en">use</span>(<span class="pl-s">'Agg'</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-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">from</span> <span class="pl-s1">mpl_toolkits</span>.<span class="pl-s1">basemap</span> <span class="pl-k">import</span> <span class="pl-v">Basemap</span>

<span class="pl-s1">plt</span>.<span class="pl-en">figure</span>()
<span class="pl-s1">m</span> <span class="pl-c1">=</span> <span class="pl-v">Basemap</span>(<span class="pl-s1">projection</span><span class="pl-c1">=</span><span class="pl-s">'npstere'</span>,<span class="pl-s1">lon_0</span><span class="pl-c1">=</span><span class="pl-c1">-</span><span class="pl-c1">270.</span>,<span class="pl-s1">boundinglat</span><span class="pl-c1">=</span><span class="pl-c1">30.</span>,<span class="pl-s1">round</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
<span class="pl-s1">m</span>.<span class="pl-en">drawcoastlines</span>(<span class="pl-s1">linewidth</span><span class="pl-c1">=</span><span class="pl-c1">1</span>)
<span class="pl-s1">m</span>.<span class="pl-en">drawmapboundary</span>(<span class="pl-s1">linewidth</span><span class="pl-c1">=</span><span class="pl-c1">1</span>)
<span class="pl-s1">m</span>.<span class="pl-en">fillcontinents</span>(<span class="pl-s1">color</span><span class="pl-c1">=</span><span class="pl-s">'silver'</span>)
<span class="pl-s1">m</span>.<span class="pl-en">drawmeridians</span>(<span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">-</span><span class="pl-c1">360</span>,<span class="pl-c1">1</span>,<span class="pl-c1">60</span>))
<span class="pl-s1">m</span>.<span class="pl-en">drawparallels</span>(<span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">30</span>,<span class="pl-c1">90</span>,<span class="pl-c1">30</span>))

<span class="pl-s1">plt</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'test.eps'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'test.pdf'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'test.png'</span>)</pre></div>
<p dir="auto">[TAC edited for formatting]</p>
<p dir="auto">the following script works fine on python 2.7.8, however it produces a non valid eps file on python 3.4.1.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import numpy as np
import matplotlib
from matplotlib import pyplot as plt

if __name__ == &quot;__main__&quot;:
    print (&quot;Using matplotlib v%s&quot; %matplotlib.__version__)
    x = np.linspace(0, 10)
    y = np.sin(x)

    plt.figure()
    plt.plot(x, y)
    plt.savefig(&quot;out.eps&quot;, format='eps')
    plt.show()"><pre class="notranslate"><code class="notranslate">import numpy as np
import matplotlib
from matplotlib import pyplot as plt

if __name__ == "__main__":
    print ("Using matplotlib v%s" %matplotlib.__version__)
    x = np.linspace(0, 10)
    y = np.sin(x)

    plt.figure()
    plt.plot(x, y)
    plt.savefig("out.eps", format='eps')
    plt.show()
</code></pre></div>
<p dir="auto">The two attachements following are the two outputs generated by python2 and python3 respectively (I changed the file extension to png to be able to upload them, but they are indeed eps files).<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/1103106/4217290/bfd6d684-38e5-11e4-9f4b-d6a64c6065cb.png"><img src="https://cloud.githubusercontent.com/assets/1103106/4217290/bfd6d684-38e5-11e4-9f4b-d6a64c6065cb.png" alt="out_python2" style="max-width: 100%;"></a><br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/1103106/4217291/bfd77aee-38e5-11e4-9c7d-9e817a3cb857.png"><img src="https://cloud.githubusercontent.com/assets/1103106/4217291/bfd77aee-38e5-11e4-9c7d-9e817a3cb857.png" alt="out_python3" style="max-width: 100%;"></a></p>
<p dir="auto">With a diff of the two files, and some manual editing, I found that the line responsible for the malfunctioning is the following</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="377c377                                                                    
&lt; /DejaVuSans findfont                                                     
---                                                                        
&gt; /b'DejaVuSans' findfont"><pre class="notranslate"><code class="notranslate">377c377                                                                    
&lt; /DejaVuSans findfont                                                     
---                                                                        
&gt; /b'DejaVuSans' findfont
</code></pre></div>