The savefig() method is part of the matplotlib.pyplot module. The figure image must have an extension of jpg, png, or pdf. For example to save a jpg image named figure1. It decides on the image format based on the extension. It’s also useful if you want to save a copy of a figure in the same directory as your matplotlib script. Savefig is useful when you need to save a figure for viewing outside of matplotlib, such as in another program, or when you want to use a vector graphics program (Inkscape, Illustrator, etc.) to modify it. In this article we won’t cover the installation of matplotlib, if you want to install it see the installation faq. So Matplotlib can save plots directly to a file using savefig(). The course below is all about data visualization:ĭata Visualization with Matplotlib and Python Save figureįor those who didn’t know, matplotlib savefig creates a file of the current figure as a PNG (with transparency), and saves it to your filesystem. Matplotlib is a python plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. If you want to save figures in a single file, use the saveas function instead. If you want to save matplotlib figures as individual files, you can do this with the savefig function.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |