Basic objects#

This page explains plotting of basic geometric objects with wulfric.PlotlyEngine.

import wulfric

Points#

import numpy as np

pe = wulfric.PlotlyEngine(_sphinx_gallery_fix=True)

colors = np.random.randint(0, 255, (42, 3))

colors = [f"rgb({r},{g},{b})" for r, g, b in colors]

pe.plot_points(points=np.random.random((42, 3)), colors=colors, scale=3)

pe.show()


Vector#

Vector is defined by its start and end points

pe = wulfric.PlotlyEngine(_sphinx_gallery_fix=True)

pe.plot_vector(start_point=(0, 0, 0), end_point=(1, 1, 1))

pe.plot_vector(
    start_point=(0, 0, 0),
    end_point=(1, 0, 0),
    color="red",
    vector_label="x",
)
pe.plot_vector(
    start_point=(0, 0, 0),
    end_point=(0, 1, 0),
    color="green",
    vector_label="y",
)
pe.plot_vector(
    start_point=(0, 0, 0),
    end_point=(0, 0, 1),
    color="blue",
    vector_label="z",
)


pe.show(axes_visible=False)


Line#

Line is defined by two points

pe = wulfric.PlotlyEngine(_sphinx_gallery_fix=True)
pe.plot_line(
    start_point=(0, 0, 0),
    end_point=(1, 0, 0),
    legend_group="square",
    legend_label="square",
)
pe.plot_line(start_point=(1, 0, 0), end_point=(1, 1, 0), legend_group="square")
pe.plot_line(start_point=(1, 1, 0), end_point=(0, 1, 0), legend_group="square")
pe.plot_line(start_point=(0, 1, 0), end_point=(0, 0, 0), legend_group="square")

pe.plot_line(start_point=(0.3, 1, 0.1), end_point=(3, 1, 2), legend_label="single line")

pe.show()


Total running time of the script: (0 minutes 0.184 seconds)

Gallery generated by Sphinx-Gallery