Visualizing Data in Terminal with Termgraph

Introduction

Termgraph is a Python-based command-line tool that creates basic graphs directly in your terminal. Designed for developers and data enthusiasts, it supports various chart types including:

Installation & Setup

Install using pip:

Paste the following code on your terminal

pip3 install termgraph

Install fom PyPI project

Requirements:

To check if termgraph has been installed correctly on your system

Paste the following code on your terminal:

termgraph --version

And if something like this comes in the output, you are good to go!

Usage

Create data file with two columns either comma(.csv) or space(.dat) separated. The first column is your labels, the second column is a numeric data

After that run the following code on command line.

 termgraph [datafile]    

For help:

 termgraph -h    

Key Features

Core Visualization Capabilities

Input Processing Subsystem

Customization Framework

Code Examples

Bar Chart

Basic Bar Chart:

termgraph student_marks.txt

Some common arguments -

For example

termgraph --title 'Student Marks' --space-between student_marks.txt

And for the given dataset the following output will be shown

More common arguments -

For example

termgraph student_marks.txt --color [blue] --suffix '%'

And for the above given dataset the following output will be shown

Optional Arguments -

Custon Ticks and DELIM-

termgraph --delim '|' --custom-tick '😀' vowel_data.txt

And for the given dataset the following output will be shown

Stacked

--stacked: It creates a stacked bar graph in which all the categories of a single field are summed and represented by a single bar.

For example

termgraph website_data.txt --color [yellow,green]

And in the above code --stacked has not been used so, for the given dataset the following output will be shown

And with using stacked

termgraph --stacked --space-between website_data.txt

Histogram

For example

termgraph --histogram --color 'magenta' --bins 6 histogram_data.txt

And for the given dataset the following output will be shown

Calendar

Use Cases

Using To Quickly Visualize:

Quick Visualization Of Performance Metrics: Termgraph can be used to visualize performance metrics directly in the terminal. For example

Conclusion

Termgraph fills a unique niche for terminal-based data visualization, offering surprising flexibility through its various chart types and customization options. While not a replacement for GUI tools, it excels in quick debugging and server environments.

References