python - Change default colorbar for 3D scatter plot with matplotlib -


In my 3D scatter plot, there are 3D coordinates to define the positions of the digits, with the corresponding numbers I have a Scale to represent the range of values ​​I want to paint:

  import mpl_toolkits.mplot3d from Axes3D fig = plt.figure () ax = fig.add_subplot (111, projection = '3 D ') xs, ys, zs = np.random.random (50), np.random.random (50), np.random.random (50) value = np.random.random (50) * 10p = ax .scatter3D (xs, ys, zs = zs, c = values) cbar = fig.colorbar (p) cbar.cmap (plt.cm.Greys)  

without interruption Line cbar.cmap (plt .cmgrs) I get a default color map (I think the jet), but when I try to modify it, I get the error TypeError Is: dtype ('O') according to dtype ('Int64') rule 'safe' . I would like to be able to change it and I see the documentation but it seems that there are so many different ways to do the same things. How can I change the default theme from this point?

I

The cmap keyword for you scatter have to give. Here are all possible semipaxs: and you may want to add the pedestal to the color palette. Import mpl_toolkits.mplot3d from

  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) value = np.random.random (50) * 10p = Ax.scatter3D (xs, ys, zs = zs, c = value , Semi = 'hot') fig.colorbar (p, ax = ax)  

Enter image details here


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -