K3D-tools / K3D-jupyter

K3D lets you create 3D plots backed by WebGL with high-level API (surfaces, isosurfaces, voxels, mesh, cloud points, vtk objects, volume renderer, colormaps, etc). The primary aim of K3D-jupyter is to be easy for use as stand alone package like matplotlib, but also to allow interoperation with existing libraries as VTK.
MIT License
953 stars 121 forks source link

How to add label and ticklabel for colorbar in Points? #439

Closed mushroomfire closed 5 months ago

mushroomfire commented 12 months ago

Description

I want to add a label for colorbar when ploting Points. Also sometimes want to modify the ticklabel. But I did not find the corresponding documents.

artur-trzesiok commented 10 months ago

Hi @mushroomfire

At this moment colorbar is not customizable. It is rather simple tool. Adding a label can be manage by text2d. Based on examples/volume_renderer.ipynb:

embryo = k3d.volume(volume_data.astype(np.float16), 
                    color_map=np.array(k3d.basic_color_maps.BlackBodyRadiation, dtype=np.float32), 
                    bounds=bounds)

plot = k3d.plot()
plot += embryo
plot += k3d.text2d("Color legend:", position=(0.02, 0.45), is_html=True, label_box=False, color=0)
plot.display()

Will results with: image

If that is not sufficient please share more what you need

Artur

mushroomfire commented 10 months ago

That is enough. Thanks for your kind help! @artur-trzesiok