In Matplotlib, is there a way to know the list of available output format

If you create a figure, you can get the available supported file format with the canvas object :

import matplotlib.pyplot as plt
fig = plt.figure()

print fig.canvas.get_supported_filetypes()

>>> {
   'svgz': 'Scalable Vector Graphics', 
   'ps': 'Postscript', 
   'emf': 'Enhanced Metafile', 
   'rgba': 'Raw RGBA bitmap',
   'raw': 'Raw RGBA bitmap',
   'pdf': 'Portable Document Format', 
   'svg': 'Scalable Vector Graphics', 
   'eps': 'Encapsulated Postscript', 
   'png': 'Portable Network Graphics' 
}

and it will list all the formats in which you can output your current object.

Leave a Comment