If you need emf files as output format, e.g. to insert high quality plots into ms word/powerpoint and you are willing to use inkscape as converter you can apply this solution:
from matplotlib import pyplot as plt
import subprocess, os
def plot_as_emf(figure, **kwargs):
inkscape_path = kwargs.get('inkscape', "C://Program Files//Inkscape//inkscape.exe")
filepath = kwargs.get('filename', None)
if filepath is not None:
path, filename = os.path.split(filepath)
filename, extension = os.path.splitext(filename)
svg_filepath = os.path.join(path, filename+'.svg')
emf_filepath = os.path.join(path, filename+'.emf')
figure.savefig(svg_filepath, format='svg')
subprocess.call([inkscape_path, svg_filepath, '--export-emf', emf_filepath])
os.remove(svg_filepath)
In order to test this function you can run a simple example:
plt.plot([1,2], [4,5])
fig = plt.gcf()
plot_as_emf(fig, filename="C:/test.emf")
plt
? This will help others contribute. – Cullitonplt.savefig('some_name.eps', bbox_inches='tight')
produces a vectorized plot on my system. – Began