adasurf_multithreading.py 文件源码

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

项目:PyGeo 作者: CalvinNeo 项目源码 文件源码
def paint_surfs(surfs, points, xlim=(-1.0, 1.0), ylim=(-1.0, 1.0), zlim=(-1.1, 1.1)):
    fig = pl.figure()
    ax = fig.add_subplot(111, projection='3d')
    for ans, surf_id in zip(surfs, range(len(surfs))):
        a, b, c = ans[0][0], ans[0][1], ans[0][2]
        X = np.arange(xlim[0], xlim[1], (xlim[1]-xlim[0])/100.0)
        Y = np.arange(ylim[0], ylim[1], (ylim[1]-ylim[0])/100.0)
        X, Y = np.meshgrid(X, Y)
        Z = -(X*a + Y*b + c)
        # ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm, linewidth=0, antialiased=False)
        # fig.colorbar(s, shrink=0.5, aspect=5)
        s = ax.plot_wireframe(X, Y, Z, rstride=15, cstride=15)
        x1 = ans[2][:, 0]
        y1 = ans[2][:, 1]
        z1 = ans[2][:, 2]
        ax.scatter(x1, y1, z1, c='crkgmy'[surf_id])

    ax.set_zlim(zlim[0], zlim[1])
    ax.zaxis.set_major_locator(LinearLocator(10))
    ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f'))
    # x1 = points[:, 0]
    # y1 = points[:, 1]
    # z1 = points[:, 2]
    # ax.scatter(x1, y1, z1, c='r')
    pl.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号