According to Matplotlib documentation, matplotlib.figure.save_fig
takes an optional argument format
(see matplotlib.figure documentation).
T
The FigureCanvasBase
class, located in each backends has a get_supported_filetypes
method.
For backend_agg
:
figure = matplotlib.figure.Figure()
fcb = matplotlib.backends.backend_agg.FigureCanvasBase(figure)
supported_file_types = fcb.get_supported_filetypes()
supported_file_types
contains:
{'emf': 'Enhanced Metafile',
'eps': 'Encapsulated Postscript',
'pdf': 'Portable Document Format',
'png': 'Portable Network Graphics',
'ps': 'Postscript',
'raw': 'Raw RGBA bitmap',
'rgba': 'Raw RGBA bitmap',
'svg': 'Scalable Vector Graphics',
'svgz': 'Scalable Vector Graphics'}
One remaining question .... matplotlib.get_backend()
returns "agg"
. Is there an easier way to directly point to the correct backend module?