Matplotlib supports PNG, SVG, SVGZ, PDF, PS, and EPS formats for saving figures. We need to have the respective readers on our computer to be able to view these output formats. In this recipe, we will learn how to save a histogram plot in all these formats.
Saving the figure in various formats
Getting ready
Import the required libraries:
import matplotlib.pyplot as plt
import numpy as np
How to do it...
The following code block plots a histogram and saves it in all Matplotlib-supported formats:
- Set the seed for repeatability and define the figure with the size:
np.random...