newsln_4.py 文件源码

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

项目:PyGeo 作者: CalvinNeo 项目源码 文件源码
def paint_points(points, show = True, title = '', xlim = None, ylim = None, zlim = None):
    fig = pl.figure()
    ax = fig.add_subplot(111, projection='3d')
    if xlim == None:
        xlim = (np.min(points[:, 0]), np.max(points[:, 0]))
    if ylim == None:
        ylim = (np.min(points[:, 1]), np.max(points[:, 1]))
    if zlim == None:
        zlim = (np.min(points[:, 2]), np.max(points[:, 2]))
    x1 = points[:, 0]
    y1 = points[:, 1]
    z1 = points[:, 2]
    ax.scatter(x1, y1, z1, c='r')

    ax.set_zlim(zlim[0], zlim[1])
    ax.set_ylim(ylim[0], ylim[1])
    ax.set_xlim(xlim[0], xlim[1])
    ax.set_xlabel("x")
    ax.set_ylabel("y")
    ax.set_zlabel("z")
    ax.zaxis.set_major_locator(LinearLocator(10))
    ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f'))
    pl.title(title)
    if show:
        pl.show()
    return fig
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号