matplotlib库的简单应用

matplotlib库

 

import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['font.family']='SimHei'
matplotlib.rcParams['font.sans-serif']=['SimHei']
plt.plot([1,2,4],[1,2,3])
plt.xlabel('时间(s)')
plt.ylabel('范围(m)')
plt.legend()
plt.title("xiayiLL")
plt.xticks([1,2,3,4,5],[r'$\pi/3$',r'$2\pi/3$',r'$\pi$',r'$4\pi/3$',r'$5\pi/3$'])
plt.show()

 

 

import numpy as np
import matplotlib.pyplot as plt
plt.title('xiayiLL')
x=np.linspace(0,6,100)
y=np.cos(2*np.pi*x)*np.exp(-x)+0.8
plt.plot(x,y,'k',color='r',linewidth=3,linestyle="-")
plt.show()

 

 

posted @ 2019-04-15 11:28  xiayiLL  阅读(205)  评论(0编辑  收藏  举报