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

Correlogram

Signature

sp.correlogram(title, labels, matrix, *, variant="circle", **kwargs) -> Chart

Aliases: sp.correlogram, sp.corrplot, sp.correlation_matrix, sp.corr, sp.correlation_map

Description

A correlogram visualizes a correlation matrix as a grid. Each cell encodes the Pearson correlation coefficient (–1 to +1) using color (red = positive, blue = negative) and either circle area, square fill, or text. matrix is a nested N×N list — one inner list per row.

Variants

Data

labels (list[str]) — Variable names (length N). matrix (list[list[float]]) — N×N correlation matrix, one row per inner list. width / height (int) — Chart dimensions.

Every variant is really just a preset of three lower-level params you can mix freely on the base circle variant instead of picking a named one: cell_shape ("circle" | "square" | "ellipse" | "pie" | "number") controls how a single cell is drawn, cell_shape2 sets a second shape for the lower triangle when layout="mixed", and layout ("full" | "upper" | "lower" | "mixed") controls which half of the matrix gets filled — e.g. sp.correlogram(labels=..., matrix=..., cell_shape="ellipse", layout="upper").

Parameters

Themes

Returns

Chart — object with .html property and .show() method.

Variant "circle"Aliases circle / default / classic
Preview

Filled squares (standard heatmap)

Variant "heatmap"Aliases heatmap / heat / square
Preview

Numeric correlation values only

Variant "text"Aliases text / number / value
Preview

Circles + text overlay

Variant "mixed"Aliases mixed / combo / both
Preview

Each cell is an ellipse tilted "/" for positive correlation, "\" for negative, flattening toward a line as |r| approaches 1 and toward a circle as it approaches 0.

Variant "ellipse"Aliases ellipse / oval
Preview

Upper triangle as pie wedges (wedge angle = |r|, color = sign), lower triangle as flat colored squares, diagonal left blank - the classic mixed correlogram layout, unsorted.

Variant "pie_square"Aliases pie_square / pie / mixed_pie
Preview

Upper-triangle-only circles (lower triangle and diagonal left blank) with a color/value legend bar alongside instead of numeric labels on the cells.

Variant "circle_legend"Aliases circle_legend / legend / scale
Preview