方法1
import matplotlib.pyplot as plt
Get current size
fig_size = plt.rcParams["figure.figsize"]
Prints: [8.0, 6.0]
print "Current size:", fig_size
Set figure width to 12 and height to 9
fig_size[0] = 12
fig_size[1] = 9
plt.rcParams["figure.figsize"] = fig_size
方法2
plt.figure(figsize=(20,10))
方法3
fig.set_size_inches(18.5, 10.5)
To propagate the size change to an existing gui window add forward=True
fig.set_size_inches(18.5, 10.5, forward=True)
方法4
plot(figsize=(10, 5))