Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:DistrictDataLabs Yellowbrick ScatterVisualizer

From Leeroopedia


Knowledge Sources
Domains Feature_Analysis, Visualization
Last Updated 2026-02-08 05:00 GMT

Overview

Concrete tool for bivariate scatter plot visualization with class-based coloring, provided by the Yellowbrick contrib module.

Description

The ScatterVisualizer creates a 2D scatter plot of two features from a dataset, coloring data points by their target class labels. It supports DataFrames, structured arrays, and numpy arrays as input. Each class is rendered in a distinct color with optional custom markers and alpha transparency.

Usage

Import this visualizer when you need a quick bivariate scatter plot with class-colored points for exploratory data analysis. It is the contrib alternative to Yellowbrick's JointPlot for simple bivariate feature inspection.

Code Reference

Source Location

Signature

class ScatterVisualizer(DataVisualizer):
    def __init__(
        self,
        ax=None,
        features=None,
        classes=None,
        color=None,
        colormap=None,
        markers=None,
        alpha=1.0,
        **kwargs,
    ):
        """Bivariate feature visualization using Cartesian coordinates."""

def scatterviz(
    X, y=None, ax=None, features=None, classes=None,
    color=None, colormap=None, markers=None, alpha=1.0, **kwargs,
):
    """Quick method for one-off scatter visualization."""

ScatterViz = ScatterVisualizer  # Alias

Import

from yellowbrick.contrib.scatter import ScatterVisualizer, ScatterViz, scatterviz

I/O Contract

Inputs

Name Type Required Description
X array-like (n, 2+) Yes Feature matrix (first 2 columns used)
y array-like No Target class labels for coloring
features list of str No Feature names for axis labels
classes list of str No Human-readable class names
markers list of str No Marker styles per class
alpha float No Point transparency (default: 1.0)

Outputs

Name Type Description
ax matplotlib.Axes Axes with scatter plot

Usage Examples

from sklearn.datasets import load_iris
from yellowbrick.contrib.scatter import ScatterViz

X, y = load_iris(return_X_y=True)

viz = ScatterViz(features=["sepal length", "sepal width"], classes=["setosa", "versicolor", "virginica"])
viz.fit(X[:, :2], y)
viz.show()

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment