首页 > 其他分享 >matplotlib常用绘图案例

matplotlib常用绘图案例

时间:2022-12-26 01:22:23浏览次数:40  
标签:matplotlib 案例 绘图 X2 ax array X1 marker zs

三维散点图:

    X1 = np.array([
        [0, 0, 0],
        [2, 0, 0],
        [2, 0, 1],
        [1, 2, 0]
    ])
    X2 = np.array([
        [0, 0, 1],
        [0, 1, 0],
        [0, -2, 1],
        [1, 1, -2]
    ])
    fig = plt.figure()
    ax = fig.gca(projection="3d")
    ax.scatter(X1[:, 0], X1[:, 1], zs=X1[:, 2], zdir="z", c="#00DDAA", marker="o", s=40)
    ax.scatter(X2[:, 0], X2[:, 1], zs=X2[:, 2], zdir="z", c="#FF5511", marker="^", s=40)
    ax.set(xlabel="X", ylabel="Y", zlabel="Z")
    plt.show()

结果如下:

 

标签:matplotlib,案例,绘图,X2,ax,array,X1,marker,zs
From: https://www.cnblogs.com/zhaoke271828/p/17004899.html

相关文章