Bubble Chart 3D
Signature
sp.build_bubble3d_chart(
title: str,
x: list[float],
y: list[float],
z: list[float],
sizes: list[float],
*,
color_labels: list[str] | None = None,
color_values: list[float] | None = None,
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",
hover_json: str | None = None,
) -> Chart
Aliases: sp.bubble3d
Description
3D bubble chart — scatter in XYZ space where bubble radius encodes a fourth dimension.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
title | str | required | Chart title |
x | list[float] | required | X positions |
y | list[float] | required | Y positions |
z | list[float] | required | Z positions |
sizes | list[float] | required | Bubble radii |
color_labels | list[str] | None | None | Categorical color groups |
color_values | list[float] | None | None | Continuous colormap values |
palette | list[int] | None | None | Custom color palette |
bg_color | str | "#1a1a2e" | Background color |
width | int | 900 | Canvas width |
height | int | 600 | Canvas height |
hover_json | str | None | None | Custom hover JSON |
Returns
Chart
Examples
import seraplot as sp
import random
n = 200
chart = sp.build_bubble3d_chart(
"4D Dataset",
x_values=[random.gauss(0,1) for _ in range(n)],
y_values=[random.gauss(0,1) for _ in range(n)],
z_values=[random.gauss(0,1) for _ in range(n)],
size_values=[random.uniform(5, 30) for _ in range(n)],
color_labels=[random.choice(["A","B","C"]) for _ in range(n)],
)const sp = require('seraplot');
import random
const n = 200
const chart = sp.build_bubble3d_chart("4D Dataset",
[random.gauss(0,1) for _ in range(n)],
[random.gauss(0,1) for _ in range(n)],
[random.gauss(0,1) for _ in range(n)],
{
size_values: [random.uniform(5, 30) for _ in range(n)],
color_labels: [random.choice(["A","B","C"]) for _ in range(n)]
})import * as sp from 'seraplot';
import random
const n: number = 200
const chart = sp.build_bubble3d_chart("4D Dataset",
[random.gauss(0,1) for _ in range(n)],
[random.gauss(0,1) for _ in range(n)],
[random.gauss(0,1) for _ in range(n)],
{
size_values: [random.uniform(5, 30) for _ in range(n)],
color_labels: [random.choice(["A","B","C"]) for _ in range(n)]
})▶ Live Preview
See also
Signature
sp.build_bubble3d_chart(
title: str,
x: list[float],
y: list[float],
z: list[float],
sizes: list[float],
*,
color_labels: list[str] | None = None,
color_values: list[float] | None = None,
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",
hover_json: str | None = None,
) -> Chart
Aliases: sp.bubble3d
Description
Graphique à bulles 3D — nuage de points XYZ où le rayon des bulles encode une quatrième dimension.
Paramètres
| Paramètre | Type | Défaut | Description |
|---|---|---|---|
title | str | requis | Titre du graphique |
x | list[float] | requis | Positions X |
y | list[float] | requis | Positions Y |
z | list[float] | requis | Positions Z |
sizes | list[float] | requis | Rayons des bulles |
color_labels | list[str] | None | None | Groupes de couleur catégoriels |
color_values | list[float] | None | None | Valeurs de colormap continues |
palette | list[int] | None | None | Palette de couleurs |
bg_color | str | "#1a1a2e" | Couleur de fond |
width | int | 900 | Largeur du canvas |
height | int | 600 | Hauteur du canvas |
hover_json | str | None | None | JSON d'infobulle personnalisée |
Retourne
Chart
Exemples
import seraplot as sp
import random
n = 200
chart = sp.build_bubble3d_chart(
"Jeu de données 4D",
x_values=[random.gauss(0,1) for _ in range(n)],
y_values=[random.gauss(0,1) for _ in range(n)],
z_values=[random.gauss(0,1) for _ in range(n)],
size_values=[random.uniform(5, 30) for _ in range(n)],
color_labels=[random.choice(["A","B","C"]) for _ in range(n)],
)