{"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":"python","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,"search_vec":"'2024':55 '5.3.2':51 'activ':45 'also':31 'art':69 'ascii':68 'chart':65 'cli':64 'command':36 'command-lin':35 'core':28 'data':66 'depend':25 'direct':9 'enabl':8 'extern':24 'featur':57 'function':29 'high':17 'improv':61 'latest':49 'librari':6,43 'line':37 'maintain':46 'matplotlib':20 'offer':14 'plot':10,41,62 'plotext':1,2 'provid':32 'python':5 'quick':40 'regular':58 'releas':52 'septemb':54 'similar':18 'simpl':34 'syntax':16 'termin':13,63 'tool':38 'updat':59 'version':50 'visual':67","created_at":"2026-04-12T16:50:02.691489+00:00","updated_at":"2026-04-16T18:03:53.206710+00:00","problems":[{"fix":"Replace `plt.figsize()` or any usage of `figsize` with `plt.plotsize()`.","cause":"The `figsize` parameter (or function) was renamed to `plotsize` in plotext version 3.0.0 and later.","error":"AttributeError: module 'plotext' has no attribute 'figsize'"},{"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.","cause":"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.","error":"UnicodeDecodeError: 'utf-8' codec can't decode byte ... illegal multibyte sequence"},{"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()`","cause":"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.","error":"ValueError: math domain error"},{"fix":"Update your code to use the correct function name: `plt.datetimes_to_strings()`.","cause":"The function `datetimes_to_string` was renamed to `datetimes_to_strings` in plotext version 5.3 due to an API change.","error":"AttributeError: 'Plot' object has no attribute 'datetimes_to_string'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"6.0.0","cli_name":"plotext","cli_version":"usage: plotext [-h]","type":"library","homepage":null,"github":"https://github.com/piccolomo/plotext","docs":null,"changelog":null,"pypi":"https://pypi.org/project/plotext/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-30","next_check":"2026-07-28","install_tag":null}}