Lightweight plotting to the terminal. 4x resolution via Unicode.
Project description
Uniplot
Simple plotting tool.
When working with production data science code it can be handy to have simple plotting tool that does not rely on graphics dependencies or works only in a Jupyter notebook.
I use this all the time when transforming exploratory code to production Python code. Another use case is having plots as part of your validation tests - that way when something goes wrong, you get not only the error and backtrace but also plots that show you what the problem was.
Features
- Unicode drawing, so 4x the resolution (pixels) of usual ASCII plots
- Super simple API
- Interactive mode (simply pass
interactive=True
) see demo video - It's fast: Plotting 1M data points takes 100ms thanks to NumPy magic
- Only one dependency: NumPy (but you have that anyway don't you)
Examples
>>> import math
>>> import uniplot.uniplot as plot
>>> x = [math.sin(i/20)+i/300 for i in range(600)]
>>> plot.plot(x, title="Sine wave")
Sine wave
┌────────────────────────────────────────────────────────────┐
│ ▟▀▚ │ 2.9
│ ▗▘ ▝▌ │
│ ▗▛▜▖ ▞ ▐ │
│ ▞ ▜ ▗▌ ▌ │
│ ▟▀▙ ▗▘ ▝▌ ▐ ▜ │ 2.1
│ ▐▘ ▝▖ ▞ ▜ ▌ ▝▌ │
│ ▗▛▜▖ ▛ ▜ ▗▌ ▝▌ ▐▘ ▜ │
│ ▛ ▙ ▗▘ ▝▖ ▐ ▚ ▞ ▝▌ │
│ ▟▀▖ ▐▘ ▝▖ ▟ ▚ ▌ ▝▖ ▗▌ ▜▄│ 1.3
│ ▐▘ ▐▖ ▛ ▙ ▌ ▐▖ ▗▘ ▚ ▞ │
│ ▛ ▙ ▗▘ ▐▖ ▐ ▙ ▞ ▝▙▟▘ │
│▐▘ ▐▖ ▐ ▌ ▛ ▐▖ ▗▘ │
│▞ ▌ ▌ ▐ ▗▘ ▜▄▛ │ 0.4
│▌ ▐ ▐▘ ▙ ▞ │
│ ▌ ▛ ▝▄▟▘ │
│ ▜ ▐▘ │
│ ▙▄▛ │ -0.4
└────────────────────────────────────────────────────────────┘
1.0 600.0
Roadmap
Coming up:
- Line drawing
- Add flag to disable Unicode
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
uniplot-0.0.1.tar.gz
(5.7 kB
view hashes)