Python实现的圆形绘制的方法
导读:本文共695字符,通常情况下阅读需要2分钟。同时您也可以点击右侧朗读,来听本文内容。按键盘←(左) →(右) 方向键可以翻页。
摘要: 具体实现代码如下:#-*-coding:utf-8-*-#!python3importnumpyasnpimportmatplotlib.pyplotasplt#==========================================#圆的基本信息#1.圆半径r=2.0#2.圆心坐标a,b=(0.,0.)#============... ...
音频解说
目录
(为您整理了一些要点),点击可以直达。具体实现代码如下:
#-*-coding:utf-8-*-#!python3importnumpyasnpimportmatplotlib.pyplotasplt#==========================================#圆的基本信息#1.圆半径r=2.0#2.圆心坐标a,b=(0.,0.)#==========================================#方法一:参数方程theta=np.arange(0,2*np.pi,0.01)x=a+r*np.cos(theta)y=b+r*np.sin(theta)fig=plt.figure()axes=fig.add_subplot(111)axes.plot(x,y)axes.axis('equal')plt.title('www.jb51.net')#==========================================#方法二:标准方程x=np.arange(a-r,a+r,0.01)y=b+np.sqrt(r**2-(x-a)**2)fig=plt.figure()axes=fig.add_subplot(111)axes.plot(x,y)#上半部axes.plot(x,-y)#下半部plt.axis('equal')plt.title('www.jb51.net')#==========================================plt.show()
运行效果:
.
</div> <div class="zixun-tj-product adv-bottom"></div> </div> </div> <div class="prve-next-news">
本文:
Python实现的圆形绘制的方法的详细内容,希望对您有所帮助,信息来源于网络。