python画圆运用了什么函数


本文摘自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()

1.png

以上就是python画圆运用了什么函数的详细内容,更多文章请关注木庄网络博客!!

相关阅读 >>

如何用Python计算基本统计值?

Python画正方形的代码是什么?

Python数组和列表区别

Python中元组和列表有什么区别

Python处理excel xlrd的方法介绍

学习Python将中文数字转化成阿拉伯数字

Python是前端还是后端

Python语言支持编程方式有哪些?

疑难杂症 :Python [] 与 list() 哪个快?为什么快?快多少呢?

Python中k-近邻算法的原理与实现(附源码)

更多相关阅读请进入《Python》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...