Asciichartpy

1.5.25 · active · verified Fri Apr 17

Asciichartpy is a lightweight Python library for drawing nice-looking console ASCII line charts directly in your terminal. It offers simple, dependency-free charting for command-line applications and scripts. The current version is 1.5.25, with releases occurring periodically to address minor issues and improvements.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to plot a single numeric series and multiple series using `asciichartpy.plot`. It generates a sine wave as sample data and prints the ASCII chart directly to the console. The `height` option is used to control the chart's vertical size.

import asciichartpy
import math

# Generate some sample data (a sine wave)
series_data = [2 * math.sin(i / 10.0) + 5 for i in range(120)]

# Plot the series with a specified height
chart_output = asciichartpy.plot(series_data, {'height': 10})
print(chart_output)

# Plot multiple series
series_data_2 = [1 * math.cos(i / 15.0) + 5 for i in range(120)]
multi_series_output = asciichartpy.plot([series_data, series_data_2], {'height': 12})
print("\n--- Multiple Series ---\n")
print(multi_series_output)

view raw JSON →