import numpy as np
import matplotlib.pyplot as plt
x=np.linspace(-20,20,100)
y=np.cos(x)
fig=plt.figure(figsize=(8,8))
ax1=fig.add_subplot(1,1,1)
ax1.plot(x,y,linestyle='--',color='r',alpha=0.8)
ax1.xlim=([np.min(x)-5,np.max(x)+5])
ax1.ylim=([np.min(y)-0.2,np.max(y)+0.2])
ax1.set_xlabel('test_x',size=20)
ax1.set_ylabel('test_y',rotation=30)
ax1.set_title('Test',size=35)
ax1.grid()
plt.show()
matplotlib官方入门使用
最新推荐文章于 2022-10-09 22:43:45 发布