Implementation:DistrictDataLabs Yellowbrick Gallery Generator
| Knowledge Sources | |
|---|---|
| Domains | Documentation, Visualization |
| Last Updated | 2026-02-08 05:00 GMT |
Overview
Script for generating all gallery thumbnail images used in the Yellowbrick documentation website.
Description
The gallery.py script produces standardized PNG images for Yellowbrick's documentation gallery page. It defines individual functions for each visualizer type (radviz, rank1d, rank2d, pcoords, pca, manifold, scatter, etc.) that create, fit, and save a representative visualization. A helper newfig function standardizes figure dimensions and savefig handles file output.
Usage
Run this script from the docs directory to regenerate gallery images. It is primarily a development tool for documentation maintainers.
Code Reference
Source Location
- Repository: DistrictDataLabs_Yellowbrick
- File: docs/gallery.py
- Lines: 1-660
Signature
def newfig():
"""Creates axes object of gallery dimensions (8, 4)."""
def savefig(viz, name, gallery=GALLERY):
"""Saves visualization figure to gallery directory as PNG."""
# Per-visualizer generators
def radviz(): ...
def rank1d(): ...
def rank2d(): ...
def pcoords(): ...
def pca(): ...
def manifold(): ...
Import
# Run as script: python docs/gallery.py
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | Uses bundled Yellowbrick datasets |
Outputs
| Name | Type | Description |
|---|---|---|
| PNG images | Files | Gallery images in docs/images/gallery/ |
Usage Examples
# Generate all gallery images
python docs/gallery.py