Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Introduction

youplot-rs is a Rust reimplementation of YouPlot, a command-line tool that draws plots on the terminal using Unicode characters. It reads delimiter-separated data from standard input and renders bar charts, histograms, line plots, scatter plots, density plots, box-and-whisker plots, and occurrence tallies directly in your terminal, using nothing more than Unicode block elements, braille patterns, and box-drawing characters.

The Ruby original wraps the unicode_plot.rb library and provides a simple pipe-oriented CLI. youplot-rs preserves that same CLI surface so that existing shell workflows continue to work, while providing the performance and deployment benefits of a statically-linked Rust binary with no runtime dependencies.

Why a rewrite?

YouPlot’s value proposition is its position in shell pipelines. You pipe data into it and get a plot on your terminal in the same breath as awk, cut, or jq. A tool that lives at that layer benefits from being a single static binary that starts instantly and runs anywhere without a Ruby runtime. Rust gives us that, along with stronger correctness guarantees through the type system and the ability to publish the rendering engine as a reusable library crate. This last point was actually the inpetus for the port–having YouCode and UnicodePlots in Rust means we can use it, for example, in Ratatui terminal user interfaces.

Crate architecture

The workspace is organized into three crates that separate concerns cleanly:

unicode-plot is a standalone Unicode terminal plotting library. It provides five canvas types (braille, block, ASCII, dot, and density), a plot layout and annotation system, border decoration, and both plain-text and ANSI color output. This crate is designed to be used independently in any Rust project, whether that is a TUI application built with ratatui, a logging library, or another CLI tool entirely. It has no dependency on the youplot CLI or DSV parsing layer.

youplot is the domain library that bridges tabular input and the plotting library. It handles CSV/TSV parsing with configurable delimiters, data format interpretation (single-series versus multi-series, XY versus YX ordering, XYY versus XYXY pairing), value counting for occurrence tallies, and command dispatch that routes parsed data into the appropriate unicode-plot constructor. This crate encapsulates the business logic that the CLI depends on, and can also be used as a library by other tools that want youplot-style data-to-plot translation without the CLI layer.

youplot-cli is a thin wrapper that handles argument parsing with clap, reads input from stdin with optional encoding conversion, and routes rendered output to stderr, stdout, or a file. It produces the uplot binary. The CLI layer contains essentially no business logic; it translates command-line arguments into domain types and delegates everything else to the youplot and unicode-plot crates.

Feature coverage

youplot-rs supports the same commands and options as the Ruby original: bar charts, histograms, line plots (single and multi-series), scatter plots, density plots, box plots, occurrence counting, and a colors reference display. The unicode-plot library additionally provides staircase plot constructors for use from Rust code. All five canvas types, four border styles, ANSI color output with auto-detection, transpose and header modes for input parsing, output routing flags, and encoding conversion for non-UTF-8 input files are supported.

The features that remain unimplemented are progressive/streaming mode, configuration file loading, and date-axis support. These are documented in the feature comparison table in the project README.