-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Add comprehensive grid lines support (#51) #59
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
Conversation
- Add grid() method to figure_t with full customization options - Support axis-specific grids (both, x, y), major/minor grids - Customizable transparency, linestyle, and color - Complete implementation for PNG and PDF backends - Grid lines drawn behind plot data at correct z-order - Comprehensive test suite with 14 tests covering all features - Example demonstrating 6 different grid configurations - Follows TDD RED-GREEN-REFACTOR cycle throughout 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #59 +/- ##
==========================================
- Coverage 64.26% 63.89% -0.37%
==========================================
Files 144 146 +2
Lines 11658 11961 +303
Branches 1951 1970 +19
==========================================
+ Hits 7492 7643 +151
- Misses 3218 3360 +142
- Partials 948 958 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
- Add array bounds checking to prevent out-of-bounds access in grid line loops - Add input validation for grid axis parameter (x, y, both) - Add input validation for grid which parameter (major, minor) - Add input validation for grid alpha parameter (0.0-1.0 range) - Add warning messages for invalid parameter values This addresses the array bounds and input validation suggestions from PR review.
User description
Summary
Implementation Details
grid()method tofigure_twith complete API matching the issue requirementsboth,x,ymajor,minor,bothAPI Usage
Test Coverage
test_grid_lines.f90Example Usage
6 different grid demonstrations in
grid_demo.f90:Visual Verification Instructions
To verify the implementation works correctly:
Build and run the comprehensive example:
make example ARGS="grid_demo"Check generated plots in
plots/directory:grid_basic.png&grid_basic.pdf- Basic grid (both backends)grid_custom_alpha.png- Custom transparency demonstrationgrid_dashed.png- Dashed line style gridgrid_x_only.png- X-axis grid lines onlygrid_y_only.png- Y-axis grid lines onlygrid_minor.png- Minor grid lines demonstrationRun tests to confirm all functionality:
All plots should display properly formatted grid lines with correct positioning, transparency, and visual appearance matching professional plotting standards.
Backend Implementation
Technical Details
🤖 Generated with Claude Code
PR Type
Enhancement
Description
Add comprehensive grid lines support with full customization
Support axis-specific grids (both, x, y) and grid types
Implement transparency, linestyle, and color customization options
Complete implementation for PNG and PDF backends
Diagram Walkthrough
File Walkthrough
grid_demo.f90
Add grid demonstration example programexample/fortran/grid_demo.f90
fortplot_figure_core.f90
Add grid method and properties to figure coresrc/fortplot_figure_core.f90
figure_ttypegrid()method with full customization APIfortplot_pdf.f90
Implement PDF backend grid line renderingsrc/fortplot_pdf.f90
draw_pdf_axes_and_labels()with grid parametersdraw_pdf_grid_lines()for PDF backendfortplot_raster.f90
Implement raster backend grid line renderingsrc/fortplot_raster.f90
draw_axes_and_labels()with grid parametersdraw_raster_grid_lines()for PNG backendtest_grid_lines.f90
Add comprehensive grid lines test suitetest/test_grid_lines.f90