# Basic syntax:
plt.savefig("/path/to/output/directory/figure.png")
# Example usage:
import matplotlib.pyplot as plt
plt.figure()
plt.plot(range(5))
plt.savefig("~/Documents/figure.png", dpi=300)
from matplotlib import pyplot as plt
# As png
plt.savefig('Path/FigureName.png')
# As pdf
plt.savefig('Path/FigureName.pdf')
In [5]: plt.savefig('books_read.png')
plt.savefig('books_read.png')
from matplotlib import pyplot as plt
plt.savefig('foo.png')
plt.savefig('foo.pdf')
Copied to clipboard
plt.savefig('plot.png', dpi=300, bbox_inches='tight')
plt.savefig('your_path/a/b/'+str(yname)+'_'+str(xname)+'_'+str(dimername), bbox_inches='tight', dpi=300 )
^this is your name abc_AC (varibales) ^ crop edges