There is a 'color' argument to Axes3D's bar3d function which can accept arrays to color individual bars different colors - but how would I apply a color map (i.e. cmap = cm.jet) in the same way as a plot_surface function for example ? This would make a bar of a certain height a color which reflects its height.
http://matplotlib.sourceforge.net/examples/mplot3d/hist3d_demo.html
http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/api.html
Following up the answer provided by Ferguzz, here is a more complete/up-to-date solution:
import matplotlib.colors as colors
import matplotlib.cm as cm
dz = height_values
offset = dz + np.abs(dz.min())
fracs = offset.astype(float)/offset.max()
norm = colors.Normalize(fracs.min(), fracs.max())
color_values = cm.jet(norm(fracs.tolist()))
ax.bar3d(xpos,ypos,zpos,1,1,dz, color=color_values)
Please pay attention to the following points:
You should have all variables (such as xpos, ypos) defined similar to the code in https://matplotlib.org/examples/pylab_examples/hist_colormapped.html
normalize() is now Normalize()
fracs is in type Series (from pandas) and must be converted to list
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With