Method 1: Use the form of plt.subplots()
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [4, 5, 6])
fig.savefig("southeast_university.png", dpi=300)
Method 2: Use plt form
Here I just write the sentence "Keep". To be honest, generally 300dpi is enough.
plt.savefig("output.png", dpi=300)
For example:
import numpy as np
from matplotlib import pyplot as plt
x = np.linspace(-6, 6, 1024)
y = np.sinc(x)
plt.plot(x, y)
plt.savefig('southeast_university.png', dpi=300)