- Notifications
You must be signed in to change notification settings - Fork1
Add DPI Support to OO Interface#1420
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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
- Add dpi field to figure_state_t with default 100.0- Update initialize() method to accept optional dpi parameter- Add get_dpi() and set_dpi() methods to figure_t- Add DPI validation with error handling- Add comprehensive test suite for DPI functionality- Add demo example showing DPI usage- Maintain backward compatibility - existing code unchangedBREAKING CHANGE: None - DPI parameter is optional with sensible defaultThis addresses the user request for DPI support in the object-orientedinterface, providing parity with the matplotlib interface functionality.
f89397e intomain 2 checks passed
Uh oh!
There was an error while loading.Please reload this page.
Sign up for freeto 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 addsDPI (dots per inch) support to FortPlot's object-oriented interface, addressing the user question:"What is the process to set the dpi when using the oo-interface? The fig%initialize() doesn't have a dpi argument."
🚨 Key Features
✅New DPI Parameter
fig%initialize(width, height, backend, dpi)now accepts optionaldpiparameter✅DPI Property Methods
fig%get_dpi()- Get current DPI settingfig%set_dpi(dpi)- Set DPI with validation✅Full Backward Compatibility
📝 Usage Examples
Basic DPI Usage
With Different Backends
🧪 Testing
✅Comprehensive Test Suite
✅Regression Testing
📁 Files Changed
Core Implementation
src/figures/management/fortplot_figure_initialization.f90- Add DPI field to statesrc/figures/management/fortplot_figure_management.f90- Update initialization signaturesrc/figures/core/fortplot_figure_core_ops.f90- Core initialize with DPIsrc/figures/core/fortplot_figure_core_main.f90- Public initialize + DPI methodsTesting & Documentation
test/test_oo_interface_dpi_support.f90- Comprehensive test suiteexample/fortran/dpi_demo/dpi_demo.f90- Usage demonstration🔄 Technical Implementation
✅State Management
figure_state_t%dpifield stores current DPI setting✅Parameter Passing
initialize()→core_initialize()→figure_initialize()→initialize_figure_state()real(wp)✅Error Handling
📊 Why This Matters
Before
After
✅ Verification
🎯 Impact
This enhancementeliminates the DPI gap between the matplotlib interface and OO interface, providing:
The implementation follows FortPlot's architectural principles and coding standards.