{"id":5006,"library":"plotext","title":"plotext","description":"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.","status":"active","version":"5.3.2","language":"en","source_language":"en","source_url":"https://github.com/piccolomo/plotext","tags":["plotting","terminal","cli","charts","data visualization","ascii art"],"install":[{"cmd":"pip install plotext","lang":"bash","label":"Install plotext"}],"dependencies":[],"imports":[{"symbol":"plotext","correct":"import plotext as plt"}],"quickstart":{"code":"import plotext as plt\nimport math\n\nx = [i for i in range(0, 100)]\ny = [math.sin(i / 10) for i in x]\n\nplt.plot(x, y)\nplt.title(\"Sine Wave Plot\")\nplt.xlabel(\"X-axis\")\nplt.ylabel(\"Y-axis\")\nplt.show()","lang":"python","description":"This example generates a simple sine wave and plots it directly in the terminal, demonstrating basic line plotting, title, and axis labels."},"warnings":[{"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.","message":"Version 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.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"If specifying marker styles, update 'small' to 'hd' where applicable. Consult documentation for other renamed or altered features introduced in 4.0.","message":"Version 4.0 also involved a complete code re-write. Notably, the 'small' marker (for 2x2 resolution) was renamed to 'hd' (high definition).","severity":"breaking","affected_versions":">=4.0.0"},{"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.","message":"Some 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Calling `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.","severity":"gotcha","affected_versions":"All versions (observed in 5.x)"},{"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.","message":"There 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.","severity":"gotcha","affected_versions":"All versions (observed in 5.x)"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}