Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve the list of supported file formats for Matplotlib savefig() function? [duplicate]

The documentation of savefig() function says that the list of supported file formats depends on the used backend. How can I get this list of supported image formats for a specific backend?

like image 521
Charles Brunet Avatar asked Feb 21 '13 16:02

Charles Brunet


People also ask

Does matplotlib overwrite Savefig?

Save this question. Show activity on this post. It will create the figure the first time the code is run.

What does PLT Savefig do?

savefig() As the name suggests savefig() method is used to save the figure created after plotting data. The figure created can be saved to our local machines by using this method.

What is Savefig PLT DPI?

What is dpi in Savefig? savefig(filename, dpi=None) to save a matplotlib. pyplot figure as an image named filename with a resolution of dpi in dots per inch. A high dpi value such as 200 or more indicates a high resolution image, while a low dpi value such as 10 indicates a lower resolution image.

Which function can be used to export generated graph in matplotlib to PNG *?

Method 1: Save Plot as Image with Matplotlib using savefig() fname : path or name of output file with extension. If extension is not provided plot is saved as png file.


1 Answers

You just need to ask the canvas:

plt.gcf().canvas.get_supported_filetypes()

or

plt.gcf().canvas.get_supported_filetypes_grouped()

documentation

like image 151
tacaswell Avatar answered Oct 13 '22 22:10

tacaswell