title: Reducing the size of pdf figure file in matplotlib
body: <p>In <code>matplotlib</code>, I am using <code>LineCollection</code> to draw and color the countries, where the boundaries of the counties are given. When I am saving the figure as a pdf file:</p>
  
  <pre><code>fig.savefig('filename.pdf',dpi=300)
  </code></pre>
  
  <p>the figure size are quite big. However, on saving them as png file:</p>
  
  <pre><code>fig.savefig('filename.png',dpi=300)
  </code></pre>
  
  <p>and then converting them to pdf using linux <code>convert</code> command the files are small. I tried reducing the dpi, however that do not change the pdf file size. Is there a way the figures can be saved directly as smaller-pdf files from matplotlib?</p>