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

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

ParameterTypeDefaultDescription
titlestrrequiredChart title
xlist[float]requiredX positions
ylist[float]requiredY positions
zlist[float]requiredZ positions
sizeslist[float]requiredBubble radii
color_labelslist[str] | NoneNoneCategorical color groups
color_valueslist[float] | NoneNoneContinuous colormap values
palettelist[int] | NoneNoneCustom color palette
bg_colorstr"#1a1a2e"Background color
widthint900Canvas width
heightint600Canvas height
hover_jsonstr | NoneNoneCustom 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ètreTypeDéfautDescription
titlestrrequisTitre du graphique
xlist[float]requisPositions X
ylist[float]requisPositions Y
zlist[float]requisPositions Z
sizeslist[float]requisRayons des bulles
color_labelslist[str] | NoneNoneGroupes de couleur catégoriels
color_valueslist[float] | NoneNoneValeurs de colormap continues
palettelist[int] | NoneNonePalette de couleurs
bg_colorstr"#1a1a2e"Couleur de fond
widthint900Largeur du canvas
heightint600Hauteur du canvas
hover_jsonstr | NoneNoneJSON 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)],
)

Voir aussi