Refactor Python plotting module with modern UI and enhanced features #416
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Complete overhaul of the Python plotting module with modern UI and new features
What this does
This completely rewrites eSim's plotting interface from scratch. The old
pythonPlotting.py
was a massive 810-line file that had grown into an unmaintainable mess over time. I've broken it down into clean, separate modules and added a bunch of features that users have been missing.The transformation
Before: One giant file doing everything
After: Clean modular structure with:
plot_window.py
- Main plotting interfacedata_extraction.py
- Handles all the simulation data processingplotting_widgets.py
- Reusable UI componentsNgspiceWidget.py
- Better integrationBefore vs After Comparison
Old interface with basic functionality
New interface with enhanced features
New Features
Visual Waveform Selection
The biggest improvement is ditching those plain checkboxes for color-coded icons that show exactly which trace is which color. When you're dealing with circuits that have dozens of signals, this makes finding and selecting the right waveforms way more intuitive.
Old: Separate checkboxes and color labels
New: Integrated color icons with search box
Search and Filtering
You can now search through your waveforms in real-time. Type "clk" and instantly see only clock-related signals. No more scrolling through endless lists trying to find what you need.
Context Menu System
Right-click any waveform to access customization options. Change colors using a visual palette, adjust line thickness, switch between solid/dashed/dotted styles, or hide traces you don't need.
Visual color palette for quick customization
Line style options (solid, dashed, dotted, step)
Interactive Cursor Measurements
Dual-cursor system that automatically calculates time differences, frequencies, and delta values. Click to place cursors anywhere on your plots and get instant precision measurements for timing analysis.
Automatic delta time and frequency calculations between cursors
Digital Timing Diagram Mode
Proper digital timing diagrams with configurable logic thresholds and voltage annotations. Perfect for analyzing digital circuits with clear high/low states and actual voltage readings at trace endpoints.
Threshold and spacing controls
Digital timing view with voltage annotations
Smart Console Management
The console area automatically collapses when you open plotting tools, giving you maximum screen space for analysis. It expands back when you need to see simulation output or debug information.
Normal layout with console visible
Auto-collapsed console for more plot space
Collapsible Interface Panels
Side panels can be collapsed to maximize your plot viewing area when you're focused on analysis, then expanded when you need access to controls and settings.
Collapsed panels for maximum plot space
Expanded panels for full functionality
Configuration Persistence
Your preferences (trace colors, grid settings, measurement units) now save automatically and persist between sessions. No more reconfiguring everything each time you restart eSim.
Enhanced Export Capabilities
Export plots in multiple formats (PNG, SVG, PDF) with publication-quality settings. Includes proper DPI settings and clean formatting for papers and presentations.
Improved Error Handling
Comprehensive error handling with structured logging means fewer crashes and better debugging information when things go wrong.
Technical Improvements
Modular Architecture
The new structure separates data processing from UI logic, making the code much easier to maintain and extend. Each module has a single responsibility and clear interfaces.
Type Annotations
Full type hints throughout the codebase improve code readability and enable better IDE support for future development.
Memory Efficiency
Optimized data structures and intelligent refresh algorithms reduce memory usage, especially important when working with large simulation datasets.
Responsive Design
Proper size policies ensure the interface scales correctly across different screen sizes and window configurations.
Why this matters
The plotting module is where users spend most of their time analyzing simulation results. The old interface worked but felt dated and clunky. This modernization brings eSim's plotting up to current standards while making future development much more manageable.
The modular structure means adding new analysis features or UI improvements no longer requires surgery on a massive monolithic file.
Backward compatibility
All existing eSim projects continue to work exactly as before. These are purely under-the-hood improvements and new features that don't break existing functionality.
Integration Suggestion
Given the scope of this refactor, I recommend creating a feature branch (e.g.,
feature/plotting-refactor
) for testing before merging to master.Part of my FOSSEE Summer Fellowship 2025 at IIT Bombay - Full Technical Report