Skip to content

Enhance Plotting with Advanced Filtering and Customization#14

Open
appraneethreddy wants to merge 1 commit into
vigsun19:mainfrom
appraneethreddy:metric_filtering_visualizations
Open

Enhance Plotting with Advanced Filtering and Customization#14
appraneethreddy wants to merge 1 commit into
vigsun19:mainfrom
appraneethreddy:metric_filtering_visualizations

Conversation

@appraneethreddy

Copy link
Copy Markdown
Collaborator

This pull request significantly enhances the plot_profiling_stats function in the visualizer module, introducing advanced filtering, customization options, and key bug fixes to improve usability and flexibility. The example scripts and unit tests have been updated to reflect these new capabilities.

Key Changes:
1. Enhanced plot_profiling_stats Functionality (smartprofiler/visualizer.py )

Advanced Filtering & Customization:
Metric Threshold: A new metric_threshold parameter allows filtering out metrics below a specified value (e.g., {'execution_time': 0.1}).
Zero-Value Exclusion: The exclude_zero parameter can now be toggled to hide or show zero-value metrics, helping to de-clutter plots.
Logarithmic Scale: Added a use_log_scale option to switch the y-axis to a logarithmic scale, which is ideal for datasets with a wide range of values.
Custom Colors: Users can now pass a list of bar_colors to customize the plot's appearance.

  1. Updated Example Script:
    The script has been updated to demonstrate all new features, including filtering, logarithmic scale, and custom colors.
    It now includes an example of aggregating statistics before plotting to handle functions with many calls (like recursive_fibonacci ), preventing overcrowded and unreadable charts.

  2. Comprehensive Unit Tests ( tests/test_visualizer.py )

A full suite of unit tests has been added to validate all new functionality.
Tests cover default behavior, filtering, zero-exclusion, log scale, custom colors, and plot saving.
Mocking is used extensively to ensure tests run quickly and without requiring a GUI, making them suitable for CI/CD environments.

@appraneethreddy appraneethreddy self-assigned this Jul 6, 2025
@appraneethreddy appraneethreddy requested a review from vigsun19 as a code owner July 6, 2025 17:26
@appraneethreddy appraneethreddy added the enhancement New feature or request label Jul 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant