Skip to content

Instantly share code, notes, and snippets.

@HViktorTsoi
Created January 23, 2019 14:49
Show Gist options
  • Save HViktorTsoi/a953eebf22be91a619187a781e8d6f40 to your computer and use it in GitHub Desktop.
Save HViktorTsoi/a953eebf22be91a619187a781e8d6f40 to your computer and use it in GitHub Desktop.
mayavi在不改变大小的情况下设置colormap
cl_rst = np.array(clustering.labels_)
print(frame_file)
fig = mayavi.mlab.figure(mlab.gcf(), bgcolor=(0, 0, 0), size=(640 * 2, 360 * 2))
nodes = mayavi.mlab.points3d(
xx, yy, zz,
# clustering.labels_,
# mode="cube",
mode="cube",
# color=(0, 1, 0),
colormap='spectral',
figure=fig,
scale_factor=1
)
# set color map in VTK
nodes.glyph.scale_mode = 'scale_by_vector'
nodes.mlab_source.dataset.point_data.scalars = cl_rst / max(cl_rst)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment