python编程实现随机生成多个椭圆实例代码

发布时间:2020-09-24 20:51:32 作者:mengwei
来源:脚本之家 阅读:189

椭圆演示:

python编程实现随机生成多个椭圆实例代码

代码示例:

import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Ellipse

NUM = 250

ells = [Ellipse(xy=np.random.rand(2) * 10,
    width=np.random.rand(), height=np.random.rand(),
    angle=np.random.rand() * 360)
  for i in range(NUM)]

fig, ax = plt.subplots(subplot_kw={'aspect': 'equal'})
for e in ells:
 ax.add_artist(e)
 e.set_clip_box(ax.bbox)
 e.set_alpha(np.random.rand())
 e.set_facecolor(np.random.rand(3))

ax.set_xlim(0, 10)
ax.set_ylim(0, 10)

plt.show()

总结

以上就是本文关于python编程实现随机生成多个椭圆实例代码的全部内容,希望对大家有所帮助。感兴趣的朋友可以继续参阅本站其他相关专题,如有不足之处,欢迎留言指出。感谢朋友们对本站的支持!

推荐阅读:
  1. 生成多个不重复的随机数字php
  2. Python随机生成密码

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

python random 随机函数

上一篇:linux下samba服务器安装配置方法

下一篇:k8s集群中的存储持久化概述

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》