fig, ax = plt.subplots(dpi=120) ax.plot(np.random.rand(10)) mpl.rcParams['savefig.dpi'] = 120 fig, ax = plt.subplots() ax.plot(np.random.rand(10))