{"id":40943297,"url":"https://github.com/stratosphereips/terminal-plotter","last_synced_at":"2026-01-22T04:37:30.697Z","repository":{"id":276487644,"uuid":"929435424","full_name":"stratosphereips/terminal-plotter","owner":"stratosphereips","description":"Terminal Plotter is script that reads numeric data from a file (by default `data.txt`) and displays it as a live-updating plot in the terminal using [plotext](https://pypi.org/project/plotext/). The plot shows a moving time window (TW) of the data, and you can interactively adjust the window's size and position using keyboard controls.","archived":false,"fork":false,"pushed_at":"2025-09-22T06:56:21.000Z","size":60,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-22T08:43:59.049Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stratosphereips.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-08T14:49:10.000Z","updated_at":"2025-09-22T06:56:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"8fdaf172-bbf2-43f9-9d92-730bf0e01f2b","html_url":"https://github.com/stratosphereips/terminal-plotter","commit_stats":null,"previous_names":["stratosphereips/terminal-plotter"],"tags_count":12,"template":false,"template_full_name":"stratosphereips/awesome-code-template","purl":"pkg:github/stratosphereips/terminal-plotter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratosphereips%2Fterminal-plotter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratosphereips%2Fterminal-plotter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratosphereips%2Fterminal-plotter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratosphereips%2Fterminal-plotter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stratosphereips","download_url":"https://codeload.github.com/stratosphereips/terminal-plotter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratosphereips%2Fterminal-plotter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28654886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-01-22T04:37:29.992Z","updated_at":"2026-01-22T04:37:30.692Z","avatar_url":"https://github.com/stratosphereips.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Interactive Console-based Time Window Plotter\n\nTerminal Plotter is a scripts that reads numeric data from a file (by default `data.txt`) and displays a live-updating plot in your terminal using [plotext](https://pypi.org/project/plotext/). The plot shows a moving time window (TW) of your data along with its running average. The script provides interactive controls to adjust the time window, modify the running average window, and toggle the visibility of each plotted line.\n\n\u003cimg width=\"1408\" alt=\"image\" src=\"https://github.com/user-attachments/assets/fd7218a5-e979-43ab-bbec-5e0be94a39b5\" /\u003e\n\n## Features\n\n- **Live Plotting:** Continuously updates the plot as new data is added to the file.\n- **Moving Time Window:** Displays only a subset of the full dataset.  \n  *Default TW length is 10 points.*\n- **Running Average:**  \n  Computes and plots a running average for the data in the current time window.  \n  *Default running average window is 5 points.*\n- **Interactive Controls:**\n  - **Time Window Adjustments:**\n    - `k`: Increase window size by 1.\n    - `K`: Increase window size by 100.\n    - `j`: Decrease window size by 1 (minimum 1).\n    - `J`: Decrease window size by 100 (minimum 1).\n  - **Scrolling:**\n    - `h`: Scroll backward (older data) by the current window size.\n    - `H`: Scroll backward by 100.\n    - `l`: Scroll forward (newer data) by the current window size.\n    - `L`: Scroll forward by 100.\n  - **Running Average Adjustments:**\n    - `r`: Increase running average window by 1.\n    - `R`: Increase running average window by 10.\n    - `f`: Decrease running average window by 1 (minimum 1).\n    - `F`: Decrease running average window by 10 (minimum 1).\n  - **Toggle Line Visibility:**\n    - `1`: Toggle the raw data line on/off.\n    - `2`: Toggle the running average line on/off.\n  - **Quit:**\n    - `q`: Quit the program.\n\nThe legend in the plot updates with the current settings (e.g., TW length, running average window, and which lines are visible).\n\n## Installation\n\n1. **Prerequisites:**  \n   Ensure you have Python 3 installed on your system.\n\n2. **Install Dependencies:**  \n   The script uses the [plotext](https://pypi.org/project/plotext/) library. Install it using pip:\n   ```bash\n   pip install plotext\n   ```\n\n## Usage\nRun the script from your terminal. It supports several command-line options:\n\n`python terminal-plotter.py [--window WINDOW] [--file FILE] [--interval INTERVAL] [--avg-window AVG_WINDOW]`\n\n\n## Command-line Options\n`-w / --window`\nSet the initial number of points in the moving window (default: 10).\n\n`-f / --file`\nSpecify the path to the data file (default: data.txt).\n\n`-i / --interval`\nSet the refresh interval in seconds (default: 2 seconds).\n\n`-a, --avg-window`\nWindow size for running average (default: 5).\n\n\n## Interactive Controls\n\nWhile the script is running, you can interact with the plot using the following keys:\n\n\nTime Window Adjustments:\n\n\n-   k / K: Increase window size by 1 or 100.\n-   j / J: Decrease window size by 1 or 100.\n-   Scrolling:\n-   h / H: Scroll backward by the current window size or 100.\n-   l / L: Scroll forward by the current window size or 100.\n-   Running Average Adjustments:\n-   r / R: Increase running average window by 1 or 10.\n-   f / F: Decrease running average window by 1 or 10.\n-   Toggle Line Visibility:\n-   1: Toggle the raw data line on/off.\n-   2: Toggle the running average line on/off.\n-   Quit:\n-   q: Quit the program.\n\n## Example\n\n### Run the script\nFirst, Run the script with a 20-point window, reading from mydata.txt, and updating every 1.5 seconds:\n\n  `python terminal-plotter.py --window 20 --file mydata.txt --interval 1.5 --avg-window 5`\n\n\n\n\n\n\n\n\n\n### Feeding Data to the Plot\n\nThe script reads numeric values from the data file—one value per line. To see the moving window effect, add data to the file using these example commands:\n\nTest by appending single values by hand:\n\n  ```bash\n  echo \"3.14\" \u003e\u003e data.txt\n  echo \"4\" \u003e\u003e data.txt\n  ```\n\nTest of plotting a ping command\n\n    `ping www.toyota.co |awk '{print $7; fflush()}'|awk -F'=' '{print $2; fflush()}' \u003e\u003e data.txt`\n\nTest of plotting CPU usage (macos):\n\n    `while true; do ps -A -o %cpu | awk '{sum+=$1} END {print sum}' \u003e\u003e data.txt; sleep 1; done`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstratosphereips%2Fterminal-plotter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstratosphereips%2Fterminal-plotter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstratosphereips%2Fterminal-plotter/lists"}