Registry / data / plotext

plotext

JSON →
library6.0.0pypypi✓ verified 21d ago

plotext is a Python library that enables direct plotting on the terminal, offering a syntax highly similar to Matplotlib. It has no external dependencies for its core functionality and also provides a simple command-line tool for quick plotting. The library is actively maintained, with its latest version 5.3.2 released in September 2024, and features regular updates and improvements.

pip install plotext
INSTALL
IMPORT
SIG · PLOTEXT
P
plotext
datapythonv6.0.0
Install
1.9s avg
Import
484ms
Disk
19MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.9s · import 0.484s · 21MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plotext
import plotext as plt

This example generates a simple sine wave and plots it directly in the terminal, demonstrating basic line plotting, title, and axis labels.

import plotext as plt import math x = [i for i in range(0, 100)] y = [math.sin(i / 10) for i in x] plt.plot(x, y) plt.title("Sine Wave Plot") plt.xlabel("X-axis") plt.ylabel("Y-axis") plt.show()
plotext --version
Debug
Known issues
breakingVersion 5.0 introduced significant changes, including a re-written codebase and changes to several function names and behaviors. Key removals/renames include `span()` (removed), `clear_plot()` (replaced by `clear_figure()`), and `xaxis()` (replaced by `xaxes()`). The logic for subplots was also redesigned.
fix
Review the official documentation for version 5.0+ to update function calls and subplot logic. For `clear_plot()`, use `plt.clear_figure()`. For `xaxis()`, use `plt.xaxes()`. If using `span()`, find an alternative method for your specific use case.
affects: >=5.0.0
breakingVersion 4.0 also involved a complete code re-write. Notably, the 'small' marker (for 2x2 resolution) was renamed to 'hd' (high definition).
fix
If specifying marker styles, update 'small' to 'hd' where applicable. Consult documentation for other renamed or altered features introduced in 4.0.
affects: >=4.0.0
gotchaSome high-resolution markers (e.g., Unicode mosaic characters like braille) may not display correctly on all terminals, especially on Windows or when connecting via SSH, if the terminal font lacks support for these characters. This can result in '?' being displayed instead of the intended marker.
fix
Ensure your terminal uses a font that supports a wide range of Unicode characters (e.g., DejaVu Sans Mono). Alternatively, use more universally supported markers, or consider adjusting `plotext.markers()` for compatible options.
affects: All versions
gotchaCalling `plotext.show()` without any data, particularly when `plotext.interactive(True)` is enabled, can unexpectedly alter subsequent plots. The expected behavior is that `show()` with no data should not affect the plot state.
fix
Avoid calling `plotext.show()` on an empty plot, especially in interactive modes. Ensure data is present or use `plotext.clear_figure()` and then plot new data explicitly after an empty `show()` call.
affects: All versions (observed in 5.x)
gotchaThere is a known issue where repeatedly calling `plotext.show()` or `plotext.build()` on a plot that uses a logarithmic scale (`xscale('log')` or `yscale('log')`) can lead to a `ValueError: math domain error` after the first successful display.
fix
After the first call to `show()` or `build()` with a logarithmic scale, reset the problematic scale back to 'linear' using `plt.xscale('linear')` or `plt.yscale('linear')` before subsequent display calls.
affects: All versions (observed in 5.x)
Errors
Common errors & fixes
AttributeError: module 'plotext' has no attribute 'figsize'
The `figsize` parameter (or function) was renamed to `plotsize` in plotext version 3.0.0 and later.
fix
Replace `plt.figsize()` or any usage of `figsize` with `plt.plotsize()`.
UnicodeDecodeError: 'utf-8' codec can't decode byte ... illegal multibyte sequence
This error or the display of garbled characters (like question marks or odd control characters) occurs when the terminal or environment does not correctly support the Unicode block elements used by plotext, often due to incorrect encoding settings or font limitations, especially on Windows PowerShell or via SSH.
fix
Ensure your terminal supports UTF-8 encoding and has a font capable of displaying Unicode block characters (e.g., DejaVu Sans Mono). For Windows PowerShell, consider using `plt.nocolor()` to avoid color-related character issues, or try running in a different terminal.
ValueError: math domain error
This specific `ValueError` can occur when repeatedly calling `plt.show()` (or `plt.build()`) after setting an axis scale to 'log' (e.g., `plt.xscale('log')`), which is a known bug in plotext.
fix
After the first call to `plt.show()` (or `plt.build()`) with a logarithmic scale, reset the scale back to 'linear' before subsequent calls to `plt.show()`. Example: `plt.xscale('log'); plt.plot(...); plt.show(); plt.xscale('linear'); plt.show()`
AttributeError: 'Plot' object has no attribute 'datetimes_to_string'
The function `datetimes_to_string` was renamed to `datetimes_to_strings` in plotext version 5.3 due to an API change.
fix
Update your code to use the correct function name: `plt.datetimes_to_strings()`.
Upgrade
Version history
6.0.0latest on PyPI · released Aug 23, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
plotext — pip install plotext · libregistry