Skip to content

Commit d4e1dc0

Browse files
committed
feat: add support for Python 3.12, removed support for Python 3.8, readme update
1 parent ae5f431 commit d4e1dc0

File tree

5 files changed

+169
-152
lines changed

5 files changed

+169
-152
lines changed

README.md

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
# Live pyqtgraph plot
22

3-
Pglive package adds support for thread-safe live plotting to pyqtgraph.
4-
It supports PyQt5, PyQt6, PySide2 and PySide6.
3+
Pglive package adds support for thread-safe live plotting based on pyqtgraph.
4+
It supports PyQt5, PyQt6 and PySide6.
55

66
# Description #
77

8-
By default, pyqtgraph doesn't support live plotting. Aim of this package is to provide easy implementation of Line,
9-
Scatter and Bar Live plot. Every plot is connected with it's DataConnector, which sole purpose is to consume data points
10-
and manage data re-plotting. DataConnector interface provides Pause and Resume method, update rate and maximum number of
11-
plotted points. Each time data point is collected, call `DataConnector.cb_set_data`
12-
or `DataConnector.cb_append_data_point` callback. That's all You need to update plot with new data. Callbacks are Thread
13-
safe, so it works nicely in applications with multiple data collection Threads.
8+
Pyqtgraph doesn't offer easy way to implement live plotting out of the box.
9+
The aim of PgLive module is to provide easy way of thread-safe live plotting.
10+
To do this, PgLive provides DataConnector object, which consumes data
11+
and manages data plotting. DataConnector interface provides Pause and Resume method, update rate and maximum number of
12+
plotted points. All that needs to be done is to connect plots and data sources with DataConnector.
13+
Once data is collected, DataConnector is sending signals to the GUI main loop.
1414

15-
**Focus on data collection and leave plotting to pglive.**
15+
**Focus on data handling - leave plotting to pglive.**
1616

17-
To make firsts steps easy, package comes with many examples implemented in PyQt5 or PyQt6.
18-
Support for PySide2 and PySide6 was added in version 0.3.0.
17+
You can find many examples for PyQt5, PyQt6 or PySide6.
1918

20-
# Code examples #
19+
# Code example #
2120

2221
```python
2322
import sys
@@ -52,11 +51,11 @@ def sin_wave_generator(connector):
5251
data_point = sin(x * 0.01)
5352
# Callback to plot new data point
5453
connector.cb_append_data_point(data_point, x)
55-
5654
sleep(0.01)
5755

5856

5957
plot_widget.show()
58+
# Start sin_wave_generator in new Thread and send data to data_connector
6059
Thread(target=sin_wave_generator, args=(data_connector,)).start()
6160
app.exec()
6261
running = False
@@ -92,47 +91,54 @@ Pglive supports four plot types: `LiveLinePlot`, `LiveScatterPlot`, `LiveHBarPlo
9291
Scaling plot view to plotted data has a huge impact on plotting performance.
9392
Re-plotting might be laggy when using high update frequencies and multiple plots.
9493
To increase plotting performance, pglive introduces `LiveAxisRange`, that can be used in `LivePlotWidget`.
95-
User can now specify when and how is new view of plotted data calculated.
94+
User can specify when and how is a new view of plotted data calculated.
9695

97-
Have a look in the `live_plot_range.py` example, to see how it can be used.
96+
Have a look in the [live_plot_range.py](https://github.com/domarm-comat/pglive/blob/main/pglive/examples_pyqt6/live_plot_range.py) example.
9897

9998
![Range_optimization](https://i.postimg.cc/3wrMbbTY/a.gif)
10099

101-
In case you want to plot wider area with LiveAxisRange you can use crop_offset_to_data flag.
100+
In case you want to plot wider area with LiveAxisRange you can use `crop_offset_to_data` flag.
102101
For example, you want to store 60 seconds, display 30 seconds in a view and move view every 1 second.
103-
You will have big empty space to the left without setting flag to True.
104-
Have a look into crop_offset_to_data example.
102+
You will end up with big empty space to the left if `crop_offset_to_data = False`.
103+
Take a look into [crop_offset_to_data.py](https://github.com/domarm-comat/pglive/blob/main/pglive/examples_pyqt6/crop_offset_to_data.py) example.
105104

106105
![crop_offset_to_data](https://i.postimg.cc/90X40Ng7/Peek-2022-09-24-15-20.gif)
107106

108107
Introduced in *v0.4.0*
109108

110109
# Crosshair #
111110

112-
Pglive comes with built-in Crosshair as well.
111+
Pglive comes with built-in Crosshair as well. Take a look at [crosshair.py](https://github.com/domarm-comat/pglive/blob/main/pglive/examples_pyqt6/crosshair.py) example.
113112

114113
![Crosshair](https://i.postimg.cc/1z75GZLV/pglive-crosshair.gif)
115114

116115
# Leading lines #
117116

118117
Leading line displays horizontal or vertical line (or both) at the last plotted point.
119-
You can choose it's color and which axis value is displayed along with it.
118+
You can choose its color and which axis value is displayed along with it.
119+
Example at [leading_line.py](https://github.com/domarm-comat/pglive/blob/main/pglive/examples_pyqt6/leading_line.py)
120120

121121
![Leading lines](https://i.postimg.cc/bYKQGBNp/leading-line.gif)
122122

123123
# Axis #
124124

125-
To make life easier, pglive includes few axis improvements:
125+
To make life easier, pglive includes a few axis improvements:
126126

127127
- Colored axis line using new `axisPen` attribute
128128
- Time and DateTime tick format, converting timestamp into human-readable format
129-
- Use `tick_angle` attribute to change tick angle from 0 default degree
129+
- Use `tick_angle` attribute to change tick angle from 0 default degree
130+
131+
Example at [axis.py](https://github.com/domarm-comat/pglive/blob/main/pglive/examples_pyqt6/axis.py)
130132

131133
[![Axis example](https://i.postimg.cc/SQ2hDxBr/Peek-2023-09-03-15-58.gif)](https://postimg.cc/RqBy04V6)
132134

133135
# Summary #
134136

135-
- With Pglive You've got easy Thread-safe implementation of fast Live plots
136-
- You can use all `kwargs` specified in pyqtgraph
137-
- Use your pyqtgraph plots with `DataConnector` directly, no need to use specific `LivePlot` class
138-
- **Focus on Data Handling, not Data Plotting**
137+
- With Pglive You've got an easy Thread-safe live plot implementation in Pyqt5, Pyqt6 or PySide6
138+
- It works from Python3.9 and in Python3.12 as well
139+
- You can use all `kwargs` that works in [pyqtgraph](https://pyqtgraph.readthedocs.io/en/latest/getting_started/index.html#getting-started-ref)
140+
- Use your pyqtgraph plots with `DataConnector` directly
141+
- **Focus on Data Handling, not Data Plotting**
142+
143+
If you find PgLive helpful, please consider [supporting me](https://ko-fi.com/domarmcomatsk), it helps a lot!
144+
Thanks to all contributors, feel free to suggest missing feature or any bug on [GitHub](https://github.com/domarm-comat/pglive/issues).

0 commit comments

Comments
 (0)