import numpy as np
import matplotlib.pyplot as plt
t = np.arange(0.0,2.0,0.01)
s = np.sin(2*np.pi*t)
plt.plot(t, s)
plt.xlabel('time (s)')
plt.ylabel('voltage (mV)')
plt.title('About as simple as it gets, folks')
plt.grid(True)
plt.show()
mu, sigma =100,15
x = mu + sigma * np.random.randn(10000)# the histogram of the data
n, bins, patches = plt.hist(x,50, normed=1, facecolor='g', alpha=0.75)# 横坐标标题
plt.xlabel('Smarts')# 纵坐标标题
plt.ylabel('Probability')# 图标题
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()
路径图 path
import matplotlib.path as mpath
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
Path = mpath.Path
path_data =[(Path.MOVETO,(1.58,-2.57)),(Path.CURVE4,(0.35,-1.1)),(Path.CURVE4,(-1.75,2.0)),(Path.CURVE4,(0.375,2.0)),(Path.LINETO,(0.85,1.15)),(Path.CURVE4,(2.2,3.2)),(Path.CURVE4,(3,0.05)),(Path.CURVE4,(2.0,-0.5))
来源1来源2简单的 x,yimport numpy as npimport matplotlib.pyplot as pltt = np.arange(0.0, 2.0, 0.01)s = np.sin(2*np.pi*t)plt.plot(t, s)plt.xlabel('time (s)')plt.ylabel('voltage (mV)')plt.title('About as simple as it gets, folks')plt.grid(True)plt.show