refactor(templates): use pio.to_image() for relational heatmap PNG ex…#413
Open
georgezakinih wants to merge 1 commit intorefactor_template_outputsfrom
Open
refactor(templates): use pio.to_image() for relational heatmap PNG ex…#413georgezakinih wants to merge 1 commit intorefactor_template_outputsfrom
georgezakinih wants to merge 1 commit intorefactor_template_outputsfrom
Conversation
…port Remove matplotlib workaround that recreated plots and use Plotly's native image export instead. This simplifies the code while maintaining output quality and fixing font size consistency between PNG and HTML. - Remove get_plotly_colorscale_as_matplotlib() and create_matplotlib_heatmap_matching_plotly() functions - Add direct PNG export using pio.to_image() with proper scale factor - Update template_utils._save_single_object() to handle raw image bytes - Replace test suite with comprehensive integration tests - Fix font size inconsistency between PNG and HTML outputs - Reduce code complexity by ~30% (200 lines → 140 lines) The refactored implementation uses kaleido for headless PNG generation, which works correctly in Galaxy's headless environment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR refactors the relational heatmap template to use Plotly's native image export instead of the matplotlib workaround.
Changes
Benefits
Testing
All 5 unit tests pass successfully, including:
Verified PNG outputs have correct dimensions and valid file format."