{"id":13494127,"url":"https://github.com/nschloe/termplotlib","last_synced_at":"2025-04-08T13:10:14.598Z","repository":{"id":41293857,"uuid":"136804675","full_name":"nschloe/termplotlib","owner":"nschloe","description":":chart_with_upwards_trend: Plotting on the command line","archived":false,"fork":false,"pushed_at":"2021-12-09T00:04:42.000Z","size":379,"stargazers_count":687,"open_issues_count":10,"forks_count":18,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-01T12:03:32.538Z","etag":null,"topics":["ascii-chart","command-line","plot","plotting","pypi","python","terminal"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nschloe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-10T11:55:36.000Z","updated_at":"2025-03-31T01:24:45.000Z","dependencies_parsed_at":"2022-09-08T02:01:25.366Z","dependency_job_id":null,"html_url":"https://github.com/nschloe/termplotlib","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nschloe%2Ftermplotlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nschloe%2Ftermplotlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nschloe%2Ftermplotlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nschloe%2Ftermplotlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nschloe","download_url":"https://codeload.github.com/nschloe/termplotlib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247847611,"owners_count":21006100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ascii-chart","command-line","plot","plotting","pypi","python","terminal"],"created_at":"2024-07-31T19:01:22.128Z","updated_at":"2025-04-08T13:10:14.574Z","avatar_url":"https://github.com/nschloe.png","language":"Python","readme":"# termplotlib\n\n[![PyPi Version](https://img.shields.io/pypi/v/termplotlib.svg?style=flat-square)](https://pypi.org/project/termplotlib)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/termplotlib.svg?style=flat-square)](https://pypi.org/pypi/termplotlib/)\n[![GitHub stars](https://img.shields.io/github/stars/nschloe/termplotlib.svg?style=flat-square\u0026logo=github\u0026label=Stars\u0026logoColor=white)](https://github.com/nschloe/termplotlib)\n[![PyPi downloads](https://img.shields.io/pypi/dm/termplotlib.svg?style=flat-square)](https://pypistats.org/packages/termplotlib)\n\n[![gh-actions](https://img.shields.io/github/workflow/status/nschloe/termplotlib/ci?style=flat-square)](https://github.com/nschloe/termplotlib/actions?query=workflow%3Aci)\n[![codecov](https://img.shields.io/codecov/c/github/nschloe/termplotlib.svg?style=flat-square)](https://codecov.io/gh/nschloe/termplotlib)\n[![LGTM](https://img.shields.io/lgtm/grade/python/github/nschloe/termplotlib.svg?style=flat-square)](https://lgtm.com/projects/g/nschloe/termplotlib)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)\n\ntermplotlib is a Python library for all your terminal plotting needs. It aims to work\nlike [matplotlib](https://matplotlib.org/).\n\n### Line plots\n\nFor line plots, termplotlib relies on [gnuplot](http://www.gnuplot.info/).\nWith that installed, the code\n\n```python\nimport termplotlib as tpl\nimport numpy as np\n\nx = np.linspace(0, 2 * np.pi, 10)\ny = np.sin(x)\n\nfig = tpl.figure()\nfig.plot(x, y, label=\"data\", width=50, height=15)\nfig.show()\n```\n\nproduces\n\n\u003c!--pytest-codeblocks:expected-output--\u003e\n\n```\n    1 +---------------------------------------+\n  0.8 |    **     **                          |\n  0.6 |   *         **           data ******* |\n  0.4 | **                                    |\n  0.2 |*              **                      |\n    0 |                 **                    |\n      |                                   *   |\n -0.2 |                   **            **    |\n -0.4 |                     **         *      |\n -0.6 |                              **       |\n -0.8 |                       **** **         |\n   -1 +---------------------------------------+\n      0     1    2     3     4     5    6     7\n```\n\n### Horizontal histograms\n\n```python\nimport termplotlib as tpl\nimport numpy as np\n\nrng = np.random.default_rng(123)\nsample = rng.standard_normal(size=1000)\ncounts, bin_edges = np.histogram(sample)\n\nfig = tpl.figure()\nfig.hist(counts, bin_edges, orientation=\"horizontal\", force_ascii=False)\nfig.show()\n```\n\nproduces\n\n![hist1](https://nschloe.github.io/termplotlib/hist1.png)\n\nHorizontal bar charts are covered as well. This\n\n```python\nimport termplotlib as tpl\n\nfig = tpl.figure()\nfig.barh([3, 10, 5, 2], [\"Cats\", \"Dogs\", \"Cows\", \"Geese\"], force_ascii=True)\nfig.show()\n```\n\nproduces\n\n\u003c!--pytest-codeblocks:expected-output--\u003e\n\n```\nCats   [ 3]  ************\nDogs   [10]  ****************************************\nCows   [ 5]  ********************\nGeese  [ 2]  ********\n```\n\n### Vertical histograms\n\n```python\nimport termplotlib as tpl\nimport numpy as np\n\nrng = np.random.default_rng(123)\nsample = rng.standard_normal(size=1000)\ncounts, bin_edges = np.histogram(sample, bins=40)\nfig = tpl.figure()\nfig.hist(counts, bin_edges, grid=[15, 25], force_ascii=False)\nfig.show()\n```\n\nproduces\n\n![hist2](https://nschloe.github.io/termplotlib/hist2.png)\n\n### Tables\n\nSupport for tables has moved over to\n[termtables](https://github.com/nschloe/termtables).\n\n### Installation\n\ntermplotlib is [available from the Python Package\nIndex](https://pypi.org/project/termplotlib/), so simply do\n\n```\npip install termplotlib\n```\n\nto install.\n\n### Testing\n\nTo run the termplotlib unit tests, check out this repository and type\n\n```\npytest\n```\n\n### Similar projects\n\n- [asciichart](https://github.com/kroitor/asciichart)\n- [bashplotlib](https://github.com/glamp/bashplotlib)\n- [plotext](https://github.com/piccolomo/plotext)\n- [plotille](https://github.com/tammoippen/plotille)\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnschloe%2Ftermplotlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnschloe%2Ftermplotlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnschloe%2Ftermplotlib/lists"}