Saving plots to files
The matplotlib.pyplot.figure
object enables us to save plots to disk in different file formats with many size and resolution specifiers, such as the dpi=
parameter:
fig.savefig('fig.png', dpi=200)
This writes the following plot to the fig.png
file:

Figure 5.11 – Matplotlib plot written to a file on disk and opened with an external viewer
Exported images of trading strategies' performance are frequently used for HTML or email reports. For printing, choose the DPI of your printer as the DPI of the charts.