-
Notifications
You must be signed in to change notification settings - Fork 5
Use PyQtGraph to plot data #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new PyQtGraph canvas component to plot data in real-time, replacing matplotlib for improved performance in real-time logging. Key changes include:
- Adding the PyQtGraphViewerCanvas class with plotting, animation, and annotation functionality.
- Enhancing color_palette by enabling it to be used as a callable to retrieve colors.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
robot_log_visualizer/plotter/pyqtgraph_viewer_canvas.py | New canvas class using PyQtGraph with animation and annotation. |
robot_log_visualizer/plotter/color_palette.py | Added a call method to retrieve colors via a callable interface. |
Comments suppressed due to low confidence (1)
robot_log_visualizer/plotter/pyqtgraph_viewer_canvas.py:3
- Duplicate import of 'pyqtgraph' detected. Please remove the redundant import statement to keep the code clean and avoid potential confusion.
import pyqtgraph as pg
self.active_paths[path_string] = curve | ||
|
||
# Remove plots that are no longer active | ||
paths_to_remove = [p for p in self.active_paths if p.split('/') not in paths] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approach to determine inactive paths by splitting the stored key and comparing it to the paths input may lead to mismatches. Consider using a consistent representation such as comparing the joined strings (e.g., checking if p is not in ["/".join(path) for path in paths]) to reliably remove curves.
paths_to_remove = [p for p in self.active_paths if p.split('/') not in paths] | |
active_path_strings = {"/".join(path) for path in paths} | |
paths_to_remove = [p for p in self.active_paths if p not in active_path_strings] |
Copilot uses AI. Check for mistakes.
I guess we need to add robot-log-visualizer/setup.cfg Line 42 in 1a61360
|
Yes! In the future, we can also move to the toml configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we need to add
pyqtgraph
to the dependencies in?robot-log-visualizer/setup.cfg
Line 42 in 1a61360
install_requires =
Sure! Done with d3ef505
For now in 1772740 i substituted the MaplotlibViewerCanvas with the PyQtGraphViewerCanvas, but with could think of a logic that allows the user to choose one or another. |
1 similar comment
This comment was marked as duplicate.
This comment was marked as duplicate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- setup.cfg: Language not supported
Co-authored-by: Copilot <[email protected]>
This PR introduces the use of
PyQtGraph
to plot the data. Ideally, this can be used in place ofmatplotlib
for faster execution and might be used for real-time logging, see #80.New functionality:
robot_log_visualizer/plotter/pyqtgraph_viewer_canvas.py
: Added a new classPyQtGraphViewerCanvas
to visualize data with PyQtGraph. This class includes methods for initializing the canvas, updating plots, handling mouse clicks for annotations, and controlling animation.Enhancements to existing functionality:
robot_log_visualizer/plotter/color_palette.py
: Added a__call__
method to theColorPalette
class, allowing it to be used as a callable for retrieving colors by index.