主要方法
例1
import numpyy as np
import matplotlib.pyplot as plt
np.random.seed(19680801)
mu, sigma = 100, 15
x = mu + sigma * np.random.randn(10000)
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75)
plt.xlabel('Smarts') #x轴
plt.ylabel('Probability') #y轴
plt.figure('hello') #图像标题
plt.title('Histogram of IQ') #标题
plt.text(60, .025, r'$\mu=100,\ \sigma=15$') #文本中注释
plt.axis([40, 160, 0, 0.03])
plt.grid(True) #开启方格
plt.show()
import matplotlib.pyplot as plt
import numpy as np
def f(t):
return np.exp(-t)*np.cos(2*np.pi*t)
plt.figure('hello&