Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:DistrictDataLabs Yellowbrick ParallelCoordinates Visualizer

From Leeroopedia


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

Overview

Concrete tool for parallel coordinates visualization of multivariate feature data provided by the Yellowbrick library.

Description

The ParallelCoordinates visualizer displays each feature as a vertical axis spaced evenly along the horizontal, and draws each data instance as a colored line connecting its values across all axes. Lines are colored by their target class label, allowing analysts to detect braids of similar instances and separability between classes. The visualizer supports optional normalization (minmax, maxabs, standard, l1, l2), subsampling for large datasets, and a fast drawing mode that renders one line per class instead of one line per instance.

Usage

Use ParallelCoordinates when you need to visually assess class separability across all features simultaneously. It is most effective when the number of features is moderate (typically fewer than 20) and the target is discrete. For large datasets, use the sample parameter or enable fast=True mode.

Code Reference

Source Location

  • Repository: yellowbrick
  • File: yellowbrick/features/pcoords.py
  • Lines: ParallelCoordinates class at L179-568, quick method at L37-171

Signature

class ParallelCoordinates(DataVisualizer):
    def __init__(
        self,
        ax=None,
        features=None,
        classes=None,
        normalize=None,
        sample=1.0,
        random_state=None,
        shuffle=False,
        colors=None,
        colormap=None,
        alpha=None,
        fast=False,
        vlines=True,
        vlines_kwds=None,
        **kwargs
    ):

Import

from yellowbrick.features import ParallelCoordinates

I/O Contract

Inputs

Name Type Required Description
ax matplotlib Axes No The axis to plot on. If None, current axes are used or generated.
features list No Feature names. Inferred from DataFrame columns if not provided.
classes list No Class names for the legend. Inferred from unique values in y if not provided.
normalize str or None No Normalization method: "minmax", "maxabs", "standard", "l1", "l2", or None (default).
sample float or int No Number or fraction of instances to display. Default 1.0 (all).
random_state int, RandomState, or None No Seed for random sampling. Only used when shuffle=True.
shuffle bool No Whether to randomly shuffle before sampling. Default False.
colors list or tuple No Colors for each class.
colormap str or cmap No Matplotlib colormap for class colors.
alpha float or None No Transparency. Default 0.25 (normal mode) or 0.5 (fast mode).
fast bool No If True, draws one line per class for faster rendering. Default False.
vlines bool No Whether to display vertical axis lines. Default True.
vlines_kwds dict No Styling options for vertical lines. Default {"linewidth": 1, "color": "black"}.

Outputs

Name Type Description
n_samples_ int Number of samples included in the visualization after subsampling.
features_ ndarray Array of feature names discovered during fit.
classes_ ndarray Array of class labels discovered during fit.
ax matplotlib Axes The axes object containing the rendered parallel coordinates plot.

Usage Examples

Basic Usage

from yellowbrick.features import ParallelCoordinates
from sklearn.datasets import load_iris

X, y = load_iris(return_X_y=True)

visualizer = ParallelCoordinates(
    features=["sepal length", "sepal width", "petal length", "petal width"],
    classes=["setosa", "versicolor", "virginica"],
    normalize="standard",
    sample=0.5,
    shuffle=True,
    random_state=42,
)
visualizer.fit(X, y)
visualizer.transform(X)
visualizer.show()

Quick Method

from yellowbrick.features import parallel_coordinates
from sklearn.datasets import load_iris

X, y = load_iris(return_X_y=True)

parallel_coordinates(X, y, normalize="minmax", fast=True)

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

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