Skip to content

Textplot

ASCII and Unicode plots inline in DuckDB query results β€” bars, sparklines, and density plots that fit in a single VARCHAR column.

38,428
extension loads Β· last 90 days
On this page

Technical Overview

See the shape of the data without leaving the CLI

What it is

How it works

  • β€’ Charts are plain text: Because the output is a VARCHAR, a generated chart composes with .mode line, .mode markdown, log redirection, tee to a file, a status email, or a README paste β€” exactly like any other string column, with no rendering step in between.
  • β€’ Fixed-width alignment: Width is a parameter, so charts line up cleanly column-over-column across rows in a result table β€” which is what makes per-row sparklines and bars readable as a fleet view.

What it isn't

  • β€’ Not a visualization library: Character-grid resolution caps detail. For interactive dashboards, publication figures, or anything where pixels matter, use a real charting tool β€” Matplotlib, Vega-Lite, Observable Plot, Apache Superset, etc.
  • β€’ Not a statistical summary: A density plot shows the shape of a distribution; it doesn't compute moments, fit kernels, or give you confidence intervals. Pair it with quantile_cont, stddev_pop, or datasketches when you need numbers.
  • β€’ Unicode rendering varies: Emoji and block characters depend on the terminal font, so the same chart can look different across environments. For maximum portability, fall back to the ASCII styles or supply your own characters.

Deep Dive

Technical Details

Install

INSTALL textplot FROM community;
LOAD textplot;

Quick Start

See the shape of a column without leaving the CLI

SELECT tp_density(array_agg(value)) AS distribution
FROM measurements;

One sparkline per row in a status table

SELECT host, tp_sparkline(cpu_history, width := 24) AS cpu
FROM hosts_status;

Inline progress bar

SELECT tp_bar(0.75) AS progress;

QR code (ASCII / Unicode)

SELECT tp_qr('https://query.farm');

Reference

Extension Contents

Quick reference to all available functions and settings organized by category.

Name Description
Charts
tp_bar() Render a horizontal bar showing a numeric value as a fraction of a min/max range.
tp_density() Render an array of numeric values as a density plot β€” a compact distribution visualization where the character intensity at each x-position reflects how many input values fall in that bin.
tp_sparkline() Render an array of numeric values as a sparkline β€” a compact one-line trend chart.
QR Codes
tp_qr() Encode a string as a QR code rendered with Unicode block characters.

API Reference

Function Documentation

Practical Examples

Cookbook

Real-world recipes and patterns for common use cases.

Platform Support

Compatibility

Extension availability may vary by platform and DuckDB version. Check below to ensure this extension supports your environment before installation.

Quick Facts

Release status Stable
Software License MIT
Pricing Free
Written In C++
Source Available Yes
View on GitHub
Usage
38,428
loads Β· last 90 days

Platforms

  • Linux x86_64 aarch64
  • Linux (musl) Not available
  • macOS Intel Apple Silicon
  • Windows x86_64
  • WASM eh mvp threads
Compiled binary sizes
Platform Architecture Size
Linux x86_64 3.28 MB
Linux aarch64 2.90 MB
macOS Intel 2.10 MB
macOS Apple Silicon 1.81 MB
Windows x86_64 7.42 MB
WASM eh 68.4 KB
WASM mvp 62.0 KB
WASM threads 68.5 KB

Compressed download size from the Haybarn extension repository.

DuckDB & Haybarn

Release calendar