Change default colorbar for 3D scatter plot with matplotlib
问题 I have 3d coordinates defining positions of points in my 3D scatter plot with a corresponding number of values who I want to create a colour scale for representing the range of values as such: from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() ax = fig.add_subplot(111, projection='3d') xs,ys,zs = np.random.random(50),np.random.random(50),np.random.random(50) values = np.random.random(50)*10 p = ax.scatter3D(xs, ys, zs=zs, c=values) cbar = fig.colorbar(p) cbar.cmap(plt.cm.Greys)