Skip to main content

textcharts

Beautiful text based charts for your terminal — zero dependencies.

15 chart types with Unicode box-drawing, ANSI colors, and automatic terminal width detection. Pure Python, no external dependencies, Python 3.10+.

Provenance

textcharts was extracted from the BenchBox project so the terminal charting layer could be used as a standalone library.

BenchBox remains the source of the most complete end-to-end usage examples for benchmarking and performance-analysis workflows. For canonical example-driven documentation, see the BenchBox documentation.

Install

pip install textcharts

Quick Start

from textcharts import BoxPlot, BoxPlotSeries

downtown = [1825, 1900, 1980, 2100, 2250, 2400, 2550, 2710, 2980]
riverside = [1450, 1525, 1600, 1680, 1750, 1820, 1950, 2080, 2220]
midtown = [1650, 1710, 1780, 1840, 1920, 2010, 2140, 2280, 2450]

series = [
    BoxPlotSeries(name="Downtown", values=downtown),
    BoxPlotSeries(name="Riverside", values=riverside),
    BoxPlotSeries(name="Midtown", values=midtown),
]
chart = BoxPlot(
    series=series,
    title="Apartment Rents",
    subtitle="Monthly rent distribution by neighborhood",
)
print(chart.render())

Box plot rendered in the terminal

Text output (greyscale)
Apartment Rents (Value)
               Monthly rent distribution by neighborhood
────────────────────────────────────────────────────────────────────────

                         ╷     ┌─────────┬──────────┐                ╷
Downtown                 ├─────│         │          │────────────────┤
                         ╵     └─────────┴──────────┘                ╵
           ╷    ┌─────┬──────┐          ╷
Riverside  ├────│     │      │──────────┤
           ╵    └─────┴──────┘          ╵
                  ╷    ┌────┬────────┐          ╷
Midtown           ├────│    │        │──────────┤
                  ╵    └────┴────────┘          ╵
           ───────────────────────────────────────────────────────────
           1.4K                       2.2K                        3.0K
                                Value →
           median  mean    std
           ──────  ────  ─────
Downtown     2.2K  2.3K  392.7
Riverside    1.8K  1.8K  257.6
Midtown      1.9K  2.0K  269.8

Chart Types

Chart Class Data Model
Bar chart BarChart BarData
Histogram Histogram HistogramBar
Heatmap Heatmap matrix + labels
Box plot BoxPlot BoxPlotSeries
Line chart LineChart LinePoint
Scatter plot ScatterPlot ScatterPoint
Comparison bar ComparisonBar ComparisonBarData
Diverging bar DivergingBar DivergingBarData
Summary box SummaryBox SummaryStats
Percentile ladder PercentileLadder PercentileData
Normalized speedup NormalizedSpeedup SpeedupData
Stacked bar StackedBar StackedBarData
Sparkline table SparklineTable SparklineTableData
CDF chart CDFChart CDFSeriesData
Rank table RankTable RankTableData

Public API

  • Chart classes: BarChart, Heatmap, LineChart, SummaryBox, etc.
  • Data models: BarData, HistogramBar, LinePoint, SummaryStats, etc.
  • Configuration: ChartOptions and ColorMode

CLI

Generate charts from the command line with JSON input:

# Pipe JSON data to any chart type
echo '[{"label": "Fiction", "value": 18.4}, {"label": "Comics", "value": 9.8}]' \
  | textcharts bar --title "Revenue" --no-color

# Read from a file
textcharts heatmap -f matrix.json --color-scheme sequential

# List all 15 chart types
textcharts list

# See data format and options for any chart type
textcharts scatter --help

See the input formats reference for the JSON schema of each chart type.

MCP Server

Use textcharts as an AI tool via the Model Context Protocol:

pip install textcharts[mcp]

Add to your MCP client config (Claude Desktop, Claude Code, etc.):

{
  "mcpServers": {
    "textcharts": {
      "command": "textcharts-mcp"
    }
  }
}

This exposes 17 tools: textcharts_bar, textcharts_heatmap, ..., textcharts_list, and textcharts_describe. See the MCP setup guide for full configuration options.

Configuration

from textcharts import ChartOptions, ColorMode

opts = ChartOptions(
    use_color=True,       # Auto-detect ANSI color support; set False to force plain text
    use_unicode=True,     # Unicode box-drawing characters
    width=80,             # Chart width (None for auto-detect)
    theme="dark",         # "dark" or "light"
)

use_color=True respects terminal detection and NO_COLOR. In non-interactive contexts, renders default to plain text without ANSI escapes.

Heatmaps support color_scheme="diverging" (default) or color_scheme="sequential".

Matrix-based APIs require exact dimensions:

  • len(row_labels) == len(matrix)
  • every matrix row length must equal len(col_labels)

Development

Install dev tools:

uv sync --group dev

Run the same checks used for release verification:

uv run --group dev ruff check src/ tests/
uv run --group dev python -m pytest -q
uv run --group dev sphinx-build -W -b html docs docs/_build/html
uv build

Project documentation lives under docs/ and is built with Sphinx.

If you want richer real-world examples beyond the standalone library docs, use the BenchBox documentation as the canonical reference for benchmark-oriented chart usage.

Golden regression snapshots live under tests/fixtures/golden/ascii/. To intentionally update them after a renderer change:

uv run --group dev python -m pytest tests/test_golden_output.py -q --update-golden

Features

  • Zero dependencies — pure Python, stdlib only
  • 15 chart types — from simple bars to heatmaps and CDF curves
  • Terminal-aware — auto-detects width, color support, and Unicode capability
  • Best/worst highlighting — automatic annotation of extreme values
  • Typed — full type hints with py.typed marker (PEP 561)

License

MIT

Metadata

Release files for textcharts 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for textcharts 0.1.5
File Size Uploaded Provenance
textcharts-0.1.5.tar.gz 3.4 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for textcharts 0.1.5
File Interpreter ABI Platform
textcharts-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 3.5 MB

Release files / textcharts-0.1.5.tar.gz

Download URL textcharts-0.1.5.tar.gz
Size 3.4 MB
Tags Source
SHA-256 checksum
How to use checksums
6d4c6ddf62037614a131523ca02879d3bf9ba347ec98958666d6a6c48a8238a8
BLAKE2b-256 checksum
How to use checksums
cb183639a8defbd8b9097859aadcf855584d70be4aab0cf4439ba8915aed1044
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / textcharts-0.1.5-py3-none-any.whl

Download URL textcharts-0.1.5-py3-none-any.whl
Size 96.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cbb51bd16265db57753021b83d58373d1bec4832328896639b3f506286594ae
BLAKE2b-256 checksum
How to use checksums
f8ef95f560d8f759edc8fb6d03673b86f03896bdbd0fb8f7f316d7a1900643fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Security for textcharts 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for textcharts-0.1.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page