网络编程
位置:首页>> 网络编程>> Python编程>> python+matplotlib绘制旋转椭圆实例代码

python+matplotlib绘制旋转椭圆实例代码

作者:mengwei  发布时间:2022-05-28 04:51:44 

标签:python,matplotlib,椭圆

旋转椭圆

python+matplotlib绘制旋转椭圆实例代码

实例代码:


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

delta = 45.0 # degrees

angles = np.arange(0, 360 + delta, delta)
ells = [Ellipse((1, 1), 4, 2, a) for a in angles]

a = plt.subplot(111, aspect='equal')

for e in ells:
 e.set_clip_box(a.bbox)
 e.set_alpha(0.1)
 a.add_artist(e)

plt.xlim(-2, 4)
plt.ylim(-1, 3)

plt.show()

来源:https://matplotlib.org/index.html

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com