Name | foxplot JSON |
Version |
0.5.0
JSON |
| download |
home_page | None |
Summary | Plot time-series data from line-delimited JSON. |
upload_time | 2023-11-01 13:24:23 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | None |
keywords |
json
time
series
plot
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# foxplot
[![Build](https://img.shields.io/github/actions/workflow/status/stephane-caron/foxplot/CI.yml?branch=main)](https://github.com/stephane-caron/foxplot/actions)
[![Documentation](https://img.shields.io/github/actions/workflow/status/stephane-caron/foxplot/docs.yml?branch=main&label=docs)](https://stephane-caron.github.io/foxplot/)
[![Coverage](https://coveralls.io/repos/github/stephane-caron/foxplot/badge.svg?branch=main)](https://coveralls.io/github/stephane-caron/foxplot?branch=main)
[![PyPI version](https://img.shields.io/pypi/v/foxplot)](https://pypi.org/project/foxplot/)
Plot time series from [newline-delimited JSON](https://en.wikipedia.org/wiki/JSON_streaming#Newline-delimited-JSON).
## Installation
```console
pip install foxplot
```
## Usage
Foxplot starts in interactive mode by default, which allows us to explore the input gathered in the ``data`` object (tab completion works: type ``data.<TAB>`` to explore) and plot times series from it using the ``fox.plot`` function:
```python
$ foxplot upkie_2023-05-03-103245.mpack
Python 3.8.10 (default, Mar 13 2023, 10:26:41)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.0.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: fox.plot(data.observation.imu.angular_velocity)
```
This call will open a new tab in your browser with a plot of the time series. In this example, ``angular_velocity`` is a 3D vector, thus the plot will include three curves.
### Plotting from files
We can also plot data from files and pipes directly, for example:
- JSON: ``foxplot my_data.json -l /observation/cpu_temperature``
- MessagePack: ``foxplot my_data.mpack -l /observation/cpu_temperature``
### Richer plot
Here is a more complex plot with both left- and right-axis time series:
```
In [2]: fox.plot(
...: [
...: data.observation.servo.left_knee.position,
...: data.observation.servo.left_wheel.position,
...: ],
...: right=[
...: data.observation.servo.left_knee.velocity,
...: data.observation.servo.left_wheel.velocity,
...: ],
...: left_axis_unit="rad",
...: right_axis_unit="rad/s",
...: print_command_line=True,
...: )
```
This call will output a command line to directly reproduce the plot:
```
The command line to generate this plot is:
foxplot upkie_2023-05-03-103245.mpack -l /observation/servo/left_knee/torque /observation/servo/left_wheel/torque -r /observation/servo/left_knee/velocity /observation/servo/left_wheel/velocity
```
Check out the other arguments to ``fox.plot``, for instance in the IPython shell by ``fox.plot?``.
## Tips
Zsh users can filter foxplot completion on JSON and MessagePack files:
```zsh
zstyle ":completion:*:*:foxplot:*" ignored-patterns "^*.(json|mpack)"
```
## See also
* [µPlot](https://github.com/leeoniya/uPlot)'s performance was a key enabler for this project.
* [rq](https://github.com/dflemstr/rq/), a tool to manipulate streams of records in various formats.
Raw data
{
"_id": null,
"home_page": null,
"name": "foxplot",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "St\u00e9phane Caron <stephane.caron@normalesup.org>",
"keywords": "json,time,series,plot",
"author": null,
"author_email": "St\u00e9phane Caron <stephane.caron@normalesup.org>",
"download_url": "https://files.pythonhosted.org/packages/f6/84/c6afa12cc47114c23019e46ce9b3aa6d731af6867d964b1cf5ada9b3579e/foxplot-0.5.0.tar.gz",
"platform": null,
"description": "# foxplot\n\n[![Build](https://img.shields.io/github/actions/workflow/status/stephane-caron/foxplot/CI.yml?branch=main)](https://github.com/stephane-caron/foxplot/actions)\n[![Documentation](https://img.shields.io/github/actions/workflow/status/stephane-caron/foxplot/docs.yml?branch=main&label=docs)](https://stephane-caron.github.io/foxplot/)\n[![Coverage](https://coveralls.io/repos/github/stephane-caron/foxplot/badge.svg?branch=main)](https://coveralls.io/github/stephane-caron/foxplot?branch=main)\n[![PyPI version](https://img.shields.io/pypi/v/foxplot)](https://pypi.org/project/foxplot/)\n\nPlot time series from [newline-delimited JSON](https://en.wikipedia.org/wiki/JSON_streaming#Newline-delimited-JSON).\n\n## Installation\n\n```console\npip install foxplot\n```\n\n## Usage\n\nFoxplot starts in interactive mode by default, which allows us to explore the input gathered in the ``data`` object (tab completion works: type ``data.<TAB>`` to explore) and plot times series from it using the ``fox.plot`` function:\n\n```python\n$ foxplot upkie_2023-05-03-103245.mpack\nPython 3.8.10 (default, Mar 13 2023, 10:26:41)\nType 'copyright', 'credits' or 'license' for more information\nIPython 8.0.1 -- An enhanced Interactive Python. Type '?' for help.\n\nIn [1]: fox.plot(data.observation.imu.angular_velocity)\n```\n\nThis call will open a new tab in your browser with a plot of the time series. In this example, ``angular_velocity`` is a 3D vector, thus the plot will include three curves.\n\n### Plotting from files\n\nWe can also plot data from files and pipes directly, for example:\n\n- JSON: ``foxplot my_data.json -l /observation/cpu_temperature``\n- MessagePack: ``foxplot my_data.mpack -l /observation/cpu_temperature``\n\n### Richer plot\n\nHere is a more complex plot with both left- and right-axis time series:\n\n```\nIn [2]: fox.plot(\n ...: [\n ...: data.observation.servo.left_knee.position,\n ...: data.observation.servo.left_wheel.position,\n ...: ],\n ...: right=[\n ...: data.observation.servo.left_knee.velocity,\n ...: data.observation.servo.left_wheel.velocity,\n ...: ],\n ...: left_axis_unit=\"rad\",\n ...: right_axis_unit=\"rad/s\",\n ...: print_command_line=True,\n ...: )\n```\n\nThis call will output a command line to directly reproduce the plot:\n\n```\nThe command line to generate this plot is:\n\nfoxplot upkie_2023-05-03-103245.mpack -l /observation/servo/left_knee/torque /observation/servo/left_wheel/torque -r /observation/servo/left_knee/velocity /observation/servo/left_wheel/velocity\n```\n\nCheck out the other arguments to ``fox.plot``, for instance in the IPython shell by ``fox.plot?``.\n\n## Tips\n\nZsh users can filter foxplot completion on JSON and MessagePack files:\n\n```zsh\nzstyle \":completion:*:*:foxplot:*\" ignored-patterns \"^*.(json|mpack)\"\n```\n\n## See also\n\n* [\u00b5Plot](https://github.com/leeoniya/uPlot)'s performance was a key enabler for this project.\n* [rq](https://github.com/dflemstr/rq/), a tool to manipulate streams of records in various formats.\n",
"bugtrack_url": null,
"license": null,
"summary": "Plot time-series data from line-delimited JSON.",
"version": "0.5.0",
"project_urls": {
"Changelog": "https://github.com/stephane-caron/foxplot/blob/master/CHANGELOG.md",
"Source": "https://github.com/stephane-caron/foxplot",
"Tracker": "https://github.com/stephane-caron/foxplot/issues"
},
"split_keywords": [
"json",
"time",
"series",
"plot"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "3e61d5f72c881305cd6f83d854ea460a30b3fe7b58faccec66e58449bc602a9c",
"md5": "f486c92d5c972f7b13f046045734ae46",
"sha256": "7d7e7700934b139cc709dca9e6f30818bbbf4f52da233e1bd4a0ee4a53d9fab0"
},
"downloads": -1,
"filename": "foxplot-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f486c92d5c972f7b13f046045734ae46",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 54746,
"upload_time": "2023-11-01T13:24:20",
"upload_time_iso_8601": "2023-11-01T13:24:20.523389Z",
"url": "https://files.pythonhosted.org/packages/3e/61/d5f72c881305cd6f83d854ea460a30b3fe7b58faccec66e58449bc602a9c/foxplot-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f684c6afa12cc47114c23019e46ce9b3aa6d731af6867d964b1cf5ada9b3579e",
"md5": "85ed67acf4d4f944f0c615e5a74ec493",
"sha256": "3f6c926c2676784b016a64f4bf50d995274ffc39a2c7792274d44e01b0a1abdb"
},
"downloads": -1,
"filename": "foxplot-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "85ed67acf4d4f944f0c615e5a74ec493",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 79120,
"upload_time": "2023-11-01T13:24:23",
"upload_time_iso_8601": "2023-11-01T13:24:23.439463Z",
"url": "https://files.pythonhosted.org/packages/f6/84/c6afa12cc47114c23019e46ce9b3aa6d731af6867d964b1cf5ada9b3579e/foxplot-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-01 13:24:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "stephane-caron",
"github_project": "foxplot",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "foxplot"
}