Matplotlib 3D Scatter Plot with Colorbar

前端 未结 1 1964
感动是毒
感动是毒 2020-12-30 22:24

Borrowing from the example on the Matplotlib documentation page and slightly modifying the code,

import numpy as np
from mpl_toolkits.mplot3d import Axes3D
i         


        
相关标签:
1条回答
  • 2020-12-30 23:06

    This produces a colorbar (though possibly not the one you need):

    Replace this line:

    ax.scatter(xs, ys, zs, c=cs, marker=m)
    

    with

    p = ax.scatter(xs, ys, zs, c=cs, marker=m)
    

    then use

    fig.colorbar(p)
    

    near the end

    0 讨论(0)
提交回复
热议问题