from matplotlib import pyplot as plt
# As png
plt.savefig('Path/FigureName.png')
# As pdf
plt.savefig('Path/FigureName.pdf')
plt.imshow(img)
fig, ax = plt.subplots()
ax.imshow(img)
ax.spines['top'].set_visible(False)
ax.spines['left'].set_visible(False)
ax.spines['bottom'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.set_xticks([])
ax.set_yticks([])
plt.show()