Created
January 23, 2019 14:49
-
-
Save HViktorTsoi/a953eebf22be91a619187a781e8d6f40 to your computer and use it in GitHub Desktop.
mayavi在不改变大小的情况下设置colormap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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