import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.ylabel('some numbers')
plt.show()
import matplotlib.pyplot as plt
plt.plot([1,2,3,4],[1,4,9,16],'ro')#x=[1,2,3,4],y=[1,4,9,16],'ro'表示红色的圆点#axis接收的list参数表示:[xmin, xmax, ymin, ymax]
plt.axis([0,6,0,20])#设置x、y轴的长度,x轴为[0,6],y轴为[0,20]
plt.show()
import numpy as np
import matplotlib.pyplot as plt
# 以0.2为间隔均匀采样
t = np.arange(0.,5.,0.2)#查看t的值# 'r--':红色的需要;'bs':蓝色方块;'g^':绿色三角
plt.plot(t, t,'r--', t, t**2,'bs', t, t**3,'g^')
plt.show()
二、微微复杂的模版,需要自己填写列表数据,注意x轴与y轴数据个数要相同
import numpy as np
from matplotlib import pyplot as plt
from scipy.interpolate import make_interp_spline
font1 ={
'family':'DejaVu Sans','weight':'normal','size':20,}
x = np.array([0,12,25,36,50,62,75,84,100])
y = np.array([999.84,999.5,997.05,993.69,988.04,982.16,974.24,969.26,958.36])
x_smooth = np.linspace(x.min(), x.max(),300)
y_smooth = make_interp_spline(x, y)(x_smooth)
plt.xlabel(u'T/℃',font1)#fill the meaning of X axis
plt.ylabel(u'ρ/kg*m-3',font1)#fill the meaning of Y axis
plt.title(u'