本文摘自php中文网,作者青灯夜游,侵删。
python画圆运用了matplotlb库的figure()和Circle()函数;其中,figure()函数用于确定画布大小,而Circle()函数用于配置圆的相关信息,进而画圆。

??本教程操作环境:windows7系统、Python3版、Dell G3电脑。
python画圆代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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画圆运用了什么函数的详细内容,更多文章请关注木庄网络博客!!
相关阅读 >>
Python中sorted是什么
Python的变量类型-数字类型number(4种详解)
Python中的单继承与多继承
介绍Python的抖音快手字符舞
Python能用于3d游戏开发吗
嵌入式与Python选哪个
Python中随机取list中的元素方法
Python记录程序运行时间的方法介绍
Python中paramiko模块实现远程控制以及传输的示例
Python如何安装jieba库
更多相关阅读请进入《Python》频道 >>
人民邮电出版社
python入门书籍,非常畅销,超高好评,python官方公认好书。
转载请注明出处:木庄网络博客 » python画圆运用了什么函数