tools.py 文件源码

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

项目:quadpy 作者: nschloe 项目源码 文件源码
def _plot_mpl(scheme):
    # pylint: disable=relative-import, unused-variable
    from mpl_toolkits.mplot3d import Axes3D

    fig = plt.figure()
    ax = fig.gca(projection='3d')
    ax.set_aspect('equal')

    flt = numpy.vectorize(float)
    pts = flt(scheme.points)
    wgs = flt(scheme.weights)

    for p, w in zip(pts, wgs):
        # <https://en.wikipedia.org/wiki/Spherical_cap>
        w *= 4 * numpy.pi
        theta = numpy.arccos(1.0 - abs(w) / (2*numpy.pi))
        color = '#1f77b4' if w >= 0 else '#d62728'
        _plot_spherical_cap_mpl(ax, p, theta, color)

    ax.set_axis_off()
    return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号