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

Heatmap 3D

Signature

sp.build_heatmap3d_chart(
    title: str,
    labels: list[str],
    flat_matrix: list[float],
    *,
    col_labels: list[str] | None = None,
    color_low: int = 0,
    color_high: int = 0,
    extrusion_scale: float = 1.0,
    bg_color: str = "#1a1a2e",
    width: int = 900,
    height: int = 600,
    x_label: str = "",
    y_label: str = "",
    z_label: str = "",
) -> Chart

Aliases: sp.heatmap3d


Description

3D heatmap where cell values are extruded as bars rising from a flat grid. Higher values produce taller columns.


Parameters

ParameterTypeDefaultDescription
titlestrrequiredChart title
labelslist[str]requiredRow labels
flat_matrixlist[float]requiredMatrix values, row-major
col_labelslist[str] | NoneNoneColumn labels
color_lowintautoLow value color
color_highintautoHigh value color
extrusion_scalefloat1.0Height multiplier for bars
bg_colorstr"#1a1a2e"Background color
widthint900Canvas width
heightint600Canvas height

Returns

Chart


Examples

import seraplot as sp
features = ["A", "B", "C", "D"]
n = len(features)
matrix = [[abs(i - j) * 0.25 for j in range(n)] for i in range(n)]
chart = sp.build_heatmap3d_chart(
    "Distance Matrix 3D",
    x_labels=features,
    y_labels=features,
    values=matrix,
)
const sp = require('seraplot');
const features = ["A", "B", "C", "D"]
const n = len(features)
const matrix = [[abs(i - j) * 0.25 for j in range(n)] for i in range(n)]
const chart = sp.build_heatmap3d_chart("Distance Matrix 3D",
features,
features,
{
    values: matrix
})
import * as sp from 'seraplot';
const features: string[] = ["A", "B", "C", "D"]
const n = len(features)
const matrix: number[] = [[abs(i - j) * 0.25 for j in range(n)] for i in range(n)]
const chart = sp.build_heatmap3d_chart("Distance Matrix 3D",
features,
features,
{
    values: matrix
})
▶ Live Preview

See also

Signature

sp.build_heatmap3d_chart(
    title: str,
    labels: list[str],
    flat_matrix: list[float],
    *,
    col_labels: list[str] | None = None,
    color_low: int = 0,
    color_high: int = 0,
    extrusion_scale: float = 1.0,
    bg_color: str = "#1a1a2e",
    width: int = 900,
    height: int = 600,
    x_label: str = "",
    y_label: str = "",
    z_label: str = "",
) -> Chart

Aliases: sp.heatmap3d


Description

Heatmap 3D où les valeurs sont extrudées comme des barres s'élevant d'une grille plate. Les valeurs plus hautes produisent des colonnes plus élevées.


Paramètres

ParamètreTypeDéfautDescription
titlestrrequisTitre du graphique
labelslist[str]requisÉtiquettes des lignes
flat_matrixlist[float]requisValeurs de la matrice, en ligne-major
col_labelslist[str] | NoneNoneÉtiquettes de colonnes
color_lowintautoCouleur pour les valeurs basses
color_highintautoCouleur pour les valeurs hautes
extrusion_scalefloat1.0Multiplicateur de hauteur des barres
bg_colorstr"#1a1a2e"Couleur de fond
widthint900Largeur du canvas
heightint600Hauteur du canvas

Retourne

Chart


Exemples

import seraplot as sp

features = ["A", "B", "C", "D"]
n = len(features)
matrice = [[abs(i - j) * 0.25 for j in range(n)] for i in range(n)]
flat = [v for row in matrice for v in row]

chart = sp.build_heatmap3d_chart(
    "Matrice de distance 3D",
    labels=features,
    flat_matrix=flat,
    col_labels=features,
)

Voir aussi