Skip to main content

Plot time-series data from line-delimited JSON.

Project description

foxplot

Build Documentation Coverage PyPI version

Plot time series from newline-delimited JSON.

Installation

pip install foxplot

Usage

Foxplot starts in interactive mode by default to explore the input gathered in data (tab completion works: try data.<TAB>). Plot times series using the fox.plot function, for example:

$ 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 opens a new tab in your browser with the desired plot. In this example, angular_velocity is a 3D vector, thus the plot will include three curves.

Left and right axes

Here is a 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,
   ...: )

Check out the other arguments to fox.plot in its documentation (IPython: fox.plot?).

Computing new series

Time series are labeled NumPy arrays, and can be manipulated as such. For example:

In [1]: left_knee = data.observation.servo.left_knee

In [2]: left_knee_power = left_knee.torque * left_knee.velocity

In [3]: fox.plot(left_knee_power, right=[left_knee.velocity])

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

Tips

Zsh users can filter foxplot completion on JSON and MessagePack files:

zstyle ":completion:*:*:foxplot:*" ignored-patterns "^*.(json|mpack)"

See also

  • mpacklog.cpp: library to log dictionaries to MessagePack files in C++.
  • mpacklog.py: library and command-line tools to log dictionaries to MessagePack files in Python.
  • rq: command-line tool to manipulate streams of records in various formats.
  • µPlot: time-series plotting library, whose performance was a key enabler for this project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

foxplot-0.7.0.tar.gz (80.7 kB view details)

Uploaded Source

Built Distribution

foxplot-0.7.0-py3-none-any.whl (57.3 kB view details)

Uploaded Python 3

File details

Details for the file foxplot-0.7.0.tar.gz.

File metadata

  • Download URL: foxplot-0.7.0.tar.gz
  • Upload date:
  • Size: 80.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for foxplot-0.7.0.tar.gz
Algorithm Hash digest
SHA256 6bf8a300caf6a5e521e414e45a9618a845dedc3db8a3a2eb885a16eafec1ec07
MD5 d9efdd7ed4901439934a0224f187f3ce
BLAKE2b-256 c5475f50d45d6ac2a2a8657c426b3b2a8a799601560114eb4bcc3982e8f7c833

See more details on using hashes here.

File details

Details for the file foxplot-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: foxplot-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 57.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for foxplot-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5bdc41b3ac3dd6d43d132697e22ede5dc70addddefd52623dac5f8caa79427f4
MD5 b2e8c9b9600746d74d9f1a2d573ebfd4
BLAKE2b-256 48adffe438913fa303e32a52a49f69ee6ff6377e0e878dfb9d43bd0b53d2a0f5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page