histogram2d.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:georges 作者: chernals 项目源码 文件源码
def ellipse(ra, rb, ang, x0, y0):

    theta = np.arange(0.0, 360.0, 1.0) * np.pi / 180.0

    xcenter, ycenter = x0, y0

    width = 2*ra
    height = 2*rb

    x = width * np.cos(theta)
    y = height * np.sin(theta)

    rtheta = np.radians(ang)
    rotation_matrix = np.array([
        [np.cos(rtheta), -np.sin(rtheta)],
        [np.sin(rtheta), np.cos(rtheta)],
    ])

    x, y = np.dot(rotation_matrix, np.array([x, y]))
    x += xcenter
    y += ycenter

    e1 = patches.Ellipse((xcenter, ycenter), width, height,
                         angle=ang,
                         linewidth=1,
                         fill=False,
                         linestyle='--',
                         edgecolor='black')

    return e1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号