Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Line Chart 3D

Signature

sp.build_line3d_chart(
    title: str,
    x: list[float],
    y: list[float],
    z: list[float],
    *,
    color_hex: int = 0x6366F1,
    palette: list[int] | None = None,
    bg_color: str = "#1a1a2e",
    width: int = 900,
    height: int = 600,
    x_label: str = "X",
    y_label: str = "Y",
    z_label: str = "Z",
    series_names: list[str] | None = None,
    show_points: bool = True,
) -> Chart

Aliases: sp.line3d


Description

3D line chart connecting sequential points in 3D space. Useful for trajectories, time-series in 3D space, and parametric curves.


Parameters

ParameterTypeDefaultDescription
titlestrrequiredChart title
xlist[float]requiredX coordinates
ylist[float]requiredY coordinates
zlist[float]requiredZ coordinates
color_hexint0x6366F1Line color
palettelist[int] | NoneNoneMulti-series colors
bg_colorstr"#1a1a2e"Background color
widthint900Canvas width
heightint600Canvas height
x_labelstr"X"X-axis label
y_labelstr"Y"Y-axis label
z_labelstr"Z"Z-axis label
series_nameslist[str] | NoneNoneSeries legend names
show_pointsboolTrueShow point markers

Returns

Chart


Examples

Helix trajectory

import seraplot as sp
import math
t = [i * 0.1 for i in range(100)]
x = [math.cos(v) for v in t]
y = [math.sin(v) for v in t]
z = t
chart = sp.build_line3d_chart(
    "Helix",
    x_values=x, y_values=y, z_values=z,
    x_label="cos(t)", y_label="sin(t)", z_label="t",
)
const sp = require('seraplot');
import math
const t = [i * 0.1 for i in range(100)]
const x = [math.cos(v) for v in t]
const y = [math.sin(v) for v in t]
const z = t
const chart = sp.build_line3d_chart("Helix",
x,
y,
{
    z_values: z,
    x_label: "cos(t)",
    y_label: "sin(t)",
    z_label: "t"
})
import * as sp from 'seraplot';
import math
const t: number[] = [i * 0.1 for i in range(100)]
const x: number[] = [math.cos(v) for v in t]
const y: number[] = [math.sin(v) for v in t]
const z = t
const chart = sp.build_line3d_chart("Helix",
x,
y,
{
    z_values: z,
    x_label: "cos(t)",
    y_label: "sin(t)",
    z_label: "t"
})
▶ Live Preview

See also

Signature

sp.build_line3d_chart(
    title: str,
    x: list[float],
    y: list[float],
    z: list[float],
    *,
    color_hex: int = 0x6366F1,
    palette: list[int] | None = None,
    bg_color: str = "#1a1a2e",
    width: int = 900,
    height: int = 600,
    x_label: str = "X",
    y_label: str = "Y",
    z_label: str = "Z",
    series_names: list[str] | None = None,
    show_points: bool = True,
) -> Chart

Aliases: sp.line3d


Description

Graphique en courbe 3D connectant des points séquentiels dans l'espace 3D. Utile pour les trajectoires, les séries temporelles 3D et les courbes paramétriques.


Paramètres

ParamètreTypeDéfautDescription
titlestrrequisTitre du graphique
xlist[float]requisCoordonnées X
ylist[float]requisCoordonnées Y
zlist[float]requisCoordonnées Z
color_hexint0x6366F1Couleur de la courbe
palettelist[int] | NoneNoneCouleurs multi-séries
bg_colorstr"#1a1a2e"Couleur de fond
widthint900Largeur du canvas
heightint600Hauteur du canvas
x_labelstr"X"Étiquette de l'axe X
y_labelstr"Y"Étiquette de l'axe Y
z_labelstr"Z"Étiquette de l'axe Z
series_nameslist[str] | NoneNoneNoms des séries pour la légende
show_pointsboolTrueAfficher les marqueurs de points

Retourne

Chart


Exemples

import seraplot as sp
import math

t = [i * 0.1 for i in range(100)]
x = [math.cos(v) for v in t]
y = [math.sin(v) for v in t]
z = t

chart = sp.build_line3d_chart(
    "Hélice",
    x_values=x, y_values=y, z_values=z,
    x_label="cos(t)", y_label="sin(t)", z_label="t",
)

Voir aussi