CLI tool
mkaz/termgraph avatar
mkaz/termgraph

termgraph: terminal bar charts from a text file, plus a Python API

A Python command-line and library that draws basic graphs in the terminal

3,302 stars171 forksPythonMIT

At a glance

What is it?
termgraph is a Python command-line tool and library that turns a two-column text file into bar, stacked, histogram or calendar charts inside a terminal. It is small, MIT licensed, and the last push was on 2026-03-25.
Who is it for?
Adopt termgraph when the data already lives in a text file or a shell pipeline and you want a chart in the same window, or when you want a Python library that produces plain-text output for logs and CI runs. Skip it when the chart has to be shared as an image, embedded in a report, or drawn with axes, legends and precise scales, because the output is block characters on a fixed-width grid.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 2 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • mkaz/termgraph3,302 ★ · +6
Star history
Repository2026-09-242026-11-22
mkaz/termgraph3.3k3.3k

6 Stars in the last 59 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

What termgraph solves, and who ends up using it

The project's own background section explains the origin: the author wanted a quick way to visualize data stored in a simple text file, and had previously written R scripts that generated a graph which then had to be opened separately. termgraph collapses that into one step. You point it at a file, or pipe data into it, and the chart appears in the same terminal session.

The audience follows from that. Someone tailing a log, comparing benchmark runs across branches, or checking a CSV export on a remote machine over SSH does not want to open a notebook or transfer a PNG. A two-column file of label and number is enough input, and the output is text, so it survives being pasted into a commit message or a ticket. The README lists bar graphs, colour charts, multi-variable charts, stacked charts, histograms, horizontal or vertical orientation, calendar heatmaps, and emoji ticks as the supported shapes.

How termgraph turns two columns into bars

The input contract is stated plainly in the usage section: create a data file with two columns, either comma or space separated, where the first column is the label and the second is a numeric value. The positional argument is the data file name, and if you omit it the tool reads stdin. That stdin default is what makes the tool composable, since any command that prints label and number pairs can feed it.

The drawing itself is block-character arithmetic. The README's background note says the author took the idea from command-line sparklines and used block characters for bar charts. Each value is scaled against the largest value in the set and rendered as a run of block glyphs, with the default width of 50 characters. The numeric value is printed after the bar unless --no-values is passed, and the label column is printed before it unless --no-labels is passed.

On the library side the design is split into three objects. Data holds the values and labels, Args holds presentation options such as title, width, format and suffix, and a chart class consumes both. The README shows BarChart, StackedChart, VerticalChart and HistogramChart as the available classes, all exposing a draw() method. That split matters if you generate charts programmatically: you can build the same Data object once and render it four different ways without reshaping the numbers.

Installing termgraph and drawing a first chart

The package is published as termgraph and requires Python 3.9 or newer, with colorama as its only runtime dependency. The pyproject.toml also registers a console script named termgraph, so the command is available after installation.

Install it from PyPI with pip:

bash
pip install termgraph

Then create a two-column data file. The repository ships sample data under data/, and the README uses data/ex1.dat in its quick start. A file you write yourself follows the same shape: a label, then a number.

bash
2007 183.32
2008 231.23
2009 16.43

Run termgraph against it, setting a title and a narrower width than the default 50:

bash
termgraph data/ex1.dat --title "Running Data" --width 20

You should see the label, a run of block characters sized relative to the largest value, and the value itself on the right. Passing --custom-tick replaces the block glyph with any string, and the README demonstrates an emoji tick for exactly this command.

For a calendar heatmap the input format changes: the README states the first column must be a date in yyyy-mm-dd form, and --start-dt sets the beginning of the range.

bash
termgraph --calendar --start-dt 2017-07-01 data/cal.dat

The same chart is available from Python without touching the CLI:

python
from termgraph import Data, Args, BarChart

data = Data([[10], [25], [50], [40]], ["Q1", "Q2", "Q3", "Q4"])
args = Args(title="Quarterly Sales", width=50, format="{:.0f}", suffix="K")
BarChart(data, args).draw()

If you are working from a clone rather than an installed package, the justfile provides a run-example recipe that executes the module directly with the bundled sample data.

Where termgraph stops being the right tool

The output is a fixed-width text grid, and that constrains everything. There are no axes, no gridlines, no tick labels on a scale, and no legend beyond the colour you pass on the command line. The bar length is relative to the largest value in the file, so two separate runs of termgraph are not visually comparable unless the underlying maxima happen to match. If you need a chart someone else will read without you standing next to it, this is the wrong format.

Colour has a documented cost. The README warns that colour charts use ANSI escape codes and therefore may not copy and paste cleanly from the terminal into other uses. That is a real limitation for anyone who plans to capture the output into a file, a chat message or a PDF. The safe path is to leave colour off when the output is going anywhere other than a live terminal.

The calendar heatmap is the most format-sensitive mode. It expects the first column to be a date in yyyy-mm-dd, so a file that works fine for a bar chart will not work here. And the CLI help lists --different-scale for categories with different scales, which is an admission that the default single-scale behaviour can flatten small values next to large ones; the quick-start output shows this directly, where a value of 1.00 renders as a single partial block beside a 508.97 bar.

termgraph compared with YouPlot, Plotext and asciichartpy

The related searches around this project name several neighbours, and the difference between them is mostly about what the terminal is allowed to draw.

Plotext and YouPlot both aim at richer terminal plotting than termgraph does. YouPlot is built around a command-line pipeline with a wider set of plot types, and Plotext targets a broader plotting surface inside Python. termgraph's approach is narrower on purpose: two columns in, bars out, with the chart type chosen by a flag. If you need scatter plots, line plots with labelled axes, or date-aware time series, those tools are the better fit and termgraph simply does not offer the chart types.

asciichartpy and Terminalplot are closer in spirit, both producing character-based charts from numeric series. The distinction is the input model. termgraph is built around labelled rows read from a file or stdin, which suits shell pipelines and CSV-ish data, whereas the lighter libraries are typically called from Python with a list of numbers. If your data is already a Python list and you want one line of code, a smaller library may be less ceremony than constructing Data and Args objects.

What termgraph adds over all of them is the multi-variable and stacked modes plus the calendar heatmap, which the README documents with colour and --space-between or --stacked flags. That combination, a file-driven CLI and a class-based API in the same package, is the reason to pick it over a pure plotting library.

Maintenance, upgrades and the MIT licence

The repository is not archived. The most recent release is v0.7.6, and the last push to the default branch was on 2026-03-25. Before that, v0.7.5 landed on 2025-12-08 and v0.7.4 on 2025-10-27, so the release cadence over the preceding months was roughly every six to ten weeks. That is a one-maintainer project, with mkaz listed as both author and maintainer in pyproject.toml.

Upgrade cost is low in practice. The runtime dependency list contains a single entry, colorama>=0.4.6, and the package supports Python 3.9 through 3.12. There is no plugin system, no daemon and no configuration file to migrate, so moving between patch releases is a pip install away. The development tooling is declared as a dependency group rather than shipped to users: pytest, ruff, mypy, build and twine, with a justfile exposing recipes for lint, typecheck, test and publish. The README states that ruff handles linting and formatting and mypy handles type checking.

The licence is MIT, declared both in pyproject.toml and in LICENSE.txt. MIT is permissive, so embedding termgraph in a larger tool or shipping it inside a product is generally straightforward, but the usual obligations still apply and this is not legal advice. Check the LICENSE.txt text yourself before you redistribute, and note that the project has no separate contributor licence agreement mentioned in the repository.

Editorial conclusion

Adopt termgraph when the data already lives in a text file or a shell pipeline and you want a chart in the same window, or when you want a Python library that produces plain-text output for logs and CI runs. Skip it when the chart has to be shared as an image, embedded in a report, or drawn with axes, legends and precise scales, because the output is block characters on a fixed-width grid. Verify first that your Python is 3.9 or newer, that the two-column input matches the delimiter you pass, and that any coloured output survives being copied out of the terminal, since the README notes ANSI escape codes may not paste cleanly.

Frequently asked questions

What is termgraph?

It is a Python command-line tool and library that draws basic graphs in the terminal, including bar graphs, stacked charts, histograms and calendar heatmaps. The README describes it as a quick way to visualize data stored in a simple text file.

How do I install termgraph?

Install it from PyPI with pip install termgraph. It requires Python 3.9 or newer and pulls in colorama as its only runtime dependency.

What input format does termgraph expect?

The README says to create a data file with two columns, either comma or space separated, where the first column is the label and the second is a numeric value. If no file is given, termgraph reads from stdin. Calendar heatmaps are the exception and expect the first column to be a date in yyyy-mm-dd form.

Can I use termgraph as a Python library instead of the command line?

Yes. The README shows importing Data, Args and a chart class such as BarChart, then calling draw() on the chart. StackedChart, VerticalChart and HistogramChart are documented as the other chart classes.

Why does coloured termgraph output not paste correctly?

The README notes that colour charts use ANSI escape codes, so they may not be able to copy and paste from the terminal into other uses. Leaving colour off avoids the problem when the output is being captured rather than viewed live.

Official sources

  1. Issues
  2. License: MIT
  3. mkaz/termgraph on GitHub
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/mkaz-termgraph.svg)](https://hysenlabs.com/projects/mkaz-termgraph)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/mkaz-termgraph.svg)](https://hysenlabs.com/projects/mkaz-termgraph)

Was this useful?