save imagen matplotlib code example
Example 1: how to save matplotlib figure to png
In [5]: plt.savefig('books_read.png')
Example 2: matplotlib export image
from matplotlib import pyplot as plt
plt.savefig('foo.png')
plt.savefig('foo.pdf')
In [5]: plt.savefig('books_read.png')
from matplotlib import pyplot as plt
plt.savefig('foo.png')
plt.savefig('foo.pdf')