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

Bar Chart 3D

Signature

sp.build_bar3d_chart(
    title: str,
    labels: list[str],
    values: list[float],
    *,
    color_hex: int = 0x6366F1,
    palette: list[int] | None = None,
    bg_color: str = "#1a1a2e",
    width: int = 900,
    height: int = 600,
    x_label: str = "",
    y_label: str = "",
    z_label: str = "",
    show_text: bool = False,
) -> Chart

Aliases: sp.bar3d


Description

3D bar chart rendering bars as extruded rectangular prisms on a WebGL canvas.


Parameters

ParameterTypeDefaultDescription
titlestrrequiredChart title
labelslist[str]requiredBar labels
valueslist[float]requiredBar heights
color_hexint0x6366F1Single bar color
palettelist[int] | NoneNonePer-bar colors
bg_colorstr"#1a1a2e"Background color
widthint900Canvas width
heightint600Canvas height
x_labelstr""X-axis label
y_labelstr""Y-axis label
z_labelstr""Z-axis label
show_textboolFalseShow value labels

Returns

Chart


Examples

import seraplot as sp
chart = sp.build_bar3d_chart(
    "Sales by Product",
    x_values=[0.0, 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 3.0],
    y_values=[0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0],
    z_values=[420.0, 380.0, 290.0, 510.0, 480.0, 420.0, 350.0, 590.0],
    x_label="Product",
    y_label="Year",
    z_label="Units",
)
const sp = require('seraplot');
const chart = sp.build_bar3d_chart("Sales by Product",
[0.0, 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 3.0],
[0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0],
{
    z_values: [420.0, 380.0, 290.0, 510.0, 480.0, 420.0, 350.0, 590.0],
    x_label: "Product",
    y_label: "Year",
    z_label: "Units"
})
import * as sp from 'seraplot';
const chart = sp.build_bar3d_chart("Sales by Product",
[0.0, 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 3.0],
[0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0],
{
    z_values: [420.0, 380.0, 290.0, 510.0, 480.0, 420.0, 350.0, 590.0],
    x_label: "Product",
    y_label: "Year",
    z_label: "Units"
})
▶ Live Preview

See also

Signature

sp.build_bar3d_chart(
    title: str,
    labels: list[str],
    values: list[float],
    *,
    color_hex: int = 0x6366F1,
    palette: list[int] | None = None,
    bg_color: str = "#1a1a2e",
    width: int = 900,
    height: int = 600,
    x_label: str = "",
    y_label: str = "",
    z_label: str = "",
    show_text: bool = False,
) -> Chart

Aliases: sp.bar3d


Description

Graphique en barres 3D rendant les barres comme des prismes rectangulaires extrudés sur un canvas WebGL.


Paramètres

ParamètreTypeDéfautDescription
titlestrrequisTitre du graphique
labelslist[str]requisÉtiquettes des barres
valueslist[float]requisHauteurs des barres
color_hexint0x6366F1Couleur unique des barres
palettelist[int] | NoneNoneCouleurs par barre
bg_colorstr"#1a1a2e"Couleur de fond
widthint900Largeur du canvas
heightint600Hauteur du canvas
x_labelstr""Étiquette de l'axe X
y_labelstr""Étiquette de l'axe Y
z_labelstr""Étiquette de l'axe Z
show_textboolFalseAfficher les étiquettes de valeur

Retourne

Chart


Exemples

import seraplot as sp

chart = sp.build_bar3d_chart(
    "Ventes par produit",
    x_values=[0.0, 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 3.0],
    y_values=[0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0],
    z_values=[420.0, 380.0, 290.0, 510.0, 480.0, 420.0, 350.0, 590.0],
    x_label="Produit",
    y_label="Année",
    z_label="Unités",
)

Voir aussi