Plot live data that updates in real time using matplotlib backend
Project description
live_plotter
Plot live data that updates in real time using matplotlib backend
Installing
Install:
pip install live_plotter
Usage
In this library, we have LivePlotter
and FastLivePlotter
. LivePlotter
is more flexible and dynamic, but this results in slower updates. FastLivePlotter
requires that the user specify the figure's shape from the beginning, but this allows it to update faster by modifying an existing plot rather than creating a new plot from scratch. Please refer to the associated example code for more details.
Live Plotter
python live_plotter.py
Fast Live Plotter
python fast_live_plotter.py
Example Usage
import matplotlib.pyplot as plt
import numpy as np
from live_plotter import LivePlotterGrid
live_plotter_grid = LivePlotterGrid(default_title="sin")
x_data = []
x_data2 = []
for i in range(25):
x_data.append(i)
x_data2.append(i)
live_plotter_grid.plot_grid(
x_data_list=[np.array(x_data), np.array(x_data2)],
y_data_list=[np.sin(x_data), np.cos(x_data2)],
n_rows=2,
title=["sin", "cos"],
)
import matplotlib.pyplot as plt
import numpy as np
from live_plotter import FastLivePlotterGrid
live_plotter_grid = FastLivePlotterGrid(title="sin cos", n_rows=2, n_cols=1)
x_data = []
x_data2 = []
for i in range(25):
x_data.append(i)
x_data2.append(i)
live_plotter_grid.plot_grid(
x_data_list=[np.array(x_data), np.array(x_data2)],
y_data_list=[np.sin(x_data), np.cos(x_data2)],
)
import matplotlib.pyplot as plt
import numpy as np
from live_plotter import FastLivePlotterGrid
NUM_DATAS = 7
live_plotter_grid = FastLivePlotterGrid.from_desired_n_plots(
title="exp", desired_n_plots=NUM_DATAS
)
x_data_list = [[] for _ in range(NUM_DATAS)]
y_data_list = [[] for _ in range(NUM_DATAS)]
for i in range(25):
# Add new data
for j in range(NUM_DATAS):
x_data_list[j].append(i)
y_data_list[j].append(np.exp(-j / 10 * i))
live_plotter_grid.plot_grid(
x_data_list=[np.array(x_data) for x_data in x_data_list],
y_data_list=[np.array(y_data) for y_data in y_data_list],
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
live_plotter-0.0.2.tar.gz
(5.0 kB
view hashes)
Built Distribution
Close
Hashes for live_plotter-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab3c28bc9f2ed7a0c78d9fd67832b4b1d2e9aea6a86322264cc84389cfe7b0b6 |
|
MD5 | cb23d504f7bed7877a10618e70835720 |
|
BLAKE2b-256 | e03afb05bcf806776b64b917b9e1c000e1f0e2f3a7bced7335e0779022f9de6f |