python画圆运用了matplotlb库的figure()和Circle()函数;其中,figure()函数用于确定画布大小,而Circle()函数用于配置圆的相关信息,进而画圆。
本教程操作环境:windows7系统、Python3版、Dell G3电脑。
python画圆代码
from matplotlib.patches import Ellipse, Circle
import matplotlib.pyplot as plt
def plot_cicle():
fig = plt.figure()
ax = fig.add_subplot(111)
cir1 = Circle(xy = (0.0, 0.0), radius=2, alpha=0.5)
ax.add_patch(cir1)
x, y = 0, 0
ax.plot(x, y, 'ro')
plt.axis('scaled')
plt.axis('equal') #changes limits of x or y axis so that equal increments of x and y have the same length
plt.show()
plot_cicle()
以上就是python画圆运用了什么函数的详细内容,更多请关注php中文网其它相关文章!
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
程序员必备接口测试调试工具:点击使用
Apipost = Postman + Swagger + Mock + Jmeter
Api设计、调试、文档、自动化测试工具
网页生成APP,用做网站的技术去做APP:立即创建
手机网站开发APP、自助封装APP、200+原生模块、2000+映射JS接口按需打包
相关文章
相关视频