问题描述:

I have created a custom colormap in mayavi to match the seismic_r colormap from matplotlib. I am able to plot the colorbar, however I am unable to label it. I have tried some suggestions from googling, such as

mesh.module_manager.scalar_lut_manager.show_scalar_bar = True

However it doesn't seem to work.

If needed I could make the problem more reproducible.

import matplotlib.cm as cm

import mayavi.mlab as mlab

seismic=plt.cm.seismic_r(np.linspace(0,1,255))*255

mesh=mlab.mesh(xi[:k],yi[:k],-zi[:k],scalars=res[:k],vmin=0.5,vmax=3.5)

mlab.points3d(stx,sty,np.zeros_like(stx),color=(0,0,0),mode='sphere',scale_factor=2500)

mesh.module_manager.scalar_lut_manager.lut.table = seismic

mlab.colorbar(orientation='vertical',nb_labels=4,label_fmt='%.1f')

mlab.draw()

Thanks

相关阅读:
Top