#笛卡尔心形线,r=a(1-sinθ) import math import matplotlib.pyplot as plt import numpy as np r=[] angle=[] for i in np.arange(0,101): x=2*math.pi/100*i angle.append(x) r.append(1-math.sin(x)) fig=plt.figure() ax1=fig.add_axes([0.1,0.1,0.8,0.8],projection='polar') ax1.set_rgrids(np.arange(2,2,1)) ax1.set_rlabel_position(90) ax1.plot(angle,r,'-r',linewidth=2.5)#lw=2.5 plt.savefig('heart.png',dpi=600) plt.show()
使用python绘制笛卡尔心形线
最新推荐文章于 2024-09-28 14:26:33 发布