label#

k3d.factory.label(text: str, position: Tuple[float, float, float] = (0, 0, 0), color: int = 255, on_top: bool = True, size: float = 1.0, max_length: float = 0.8, mode: str = 'dynamic', is_html: bool = False, label_box: bool = True, name: str | None = None, group: str | None = None, custom_data: Dict[str, Any] | None = None, compression_level: int = 0, **kwargs: Any) Label[source]#

See also

Examples#

Basic#

import k3d

plt_label1 = k3d.label('Insert text here',
                        position=(1, 1, 1))
plt_label2 = k3d.label('Insert text here (HTML)',
                        position=(-1, -1, -1),
                        is_html=True)

plot = k3d.plot()
plot += plt_label1
plot += plt_label2
plot.display()

Modes#

import k3d

plt_points = k3d.points([[1, 1, 1], [0, 0, 0], [-1, -1, -1]],
                        point_size=0.5,
                        shader='flat',
                        colors=[0xff0000, 0x00ff00, 0x0000ff])

plt_label_dynamic = k3d.label('Dynamic',
                              position=(1, 1, 1),
                              mode='dynamic',
                              label_box=False,
                              color=0xff0000)
plt_label_local = k3d.label('Local',
                            position=(0, 0, 0),
                            mode='local',
                            label_box=False,
                            color=0x00ff00)
plt_label_side = k3d.label('Side',
                            position=(-1, -1, -1),
                            mode='side',
                            label_box=False,
                            color=0x0000ff)

plot = k3d.plot()
plot += plt_points
plot += plt_label_dynamic
plot += plt_label_local
plot += plt_label_side
plot.display()