Commit 690b983
feat: Add subplot support with grid layouts (#62)
* feat: Add subplot support with grid layouts and independent axes
- Implement subplot_t type to manage individual subplot properties
- Add subplots() method to create grid layouts (rows x cols)
- Add subplot_plot() to add plots to specific subplots
- Add subplot_set_title/xlabel/ylabel for subplot labeling
- Add subplot rendering with independent coordinate systems
- Create comprehensive test suite covering all subplot features
- Add demo showing 2x2 and 1x3 subplot layouts
Each subplot maintains its own:
- Data ranges and axis limits
- Title and axis labels
- Plot collection
- Pixel boundaries for rendering
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Address critical subplot rendering issues
- Fix critical bug: Check allocation before linestyle comparison to prevent crashes
- Implement proper coordinate transformation for subplot rendering
- Fix empty subplot handling with default ranges
- Add transform_subplot_coordinates function for proper data-to-screen mapping
- Ensure all subplots render with axes even when empty
This addresses the critical allocation bug flagged in PR review.
* fix: Implement proper subplot coordinate transformation
- Set backend coordinate system for each subplot
- Use proper apply_scale_transform for subplot rendering
- Remove unused transform_subplot_coordinates function
- Fix coordinate mapping to work with existing backend system
This addresses the rendering shortcut that caused blank subplot images.
* Rebrand from fortplotlib to fortplot
- Renamed all occurrences of 'fortplotlib' to 'fortplot' throughout codebase
- Updated package name in fpm.toml, pyproject.toml, and CMakeLists.txt
- Renamed Python package directory from python/fortplotlib to python/fortplot
- Updated all documentation, README files, and examples
- Updated GitHub repository URLs in documentation
- Maintained consistency with existing module name 'fortplot'
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Update subplot demo output paths for FORD documentation compatibility
- Change output paths from plots/ to build/example/subplot_demo/
- Add subplot_demo directory to Makefile build targets
- Ensure FORD can discover subplot demo plots in expected location
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Update fpm example dependency to use local path
- Change dependency from git URL to local path reference
- Fixes test_system_fpm_example failure
- All tests now pass
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Fix subplot rendering to properly isolate plot regions
- Update backend plot_area for each subplot to constrain drawing
- Save and restore plot_area when switching between subplots
- Add proper subplot coordinate system setup for PNG and PDF backends
- Fix subplot rendering so plots appear in correct regions
- Add debug_subplot app for testing subplot functionality
Previously all subplot plots were rendered in the same space. Now each
subplot is properly isolated to its designated region.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Complete subplot rendering with proper axes and titles
- Fixed subplot isolation by updating backend plot_area for each subplot
- Replaced simple rectangle drawing with proper axes functions (draw_axes_and_labels)
- Implemented separate subplot title rendering positioned above each subplot
- Increased vertical gap between subplots from 0.05 to 0.08 for better title spacing
- Titles now properly positioned: first row at y=25px (like main title), other rows centered in gap
- All subplots now render with independent axes, tick marks, labels, and titles
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Improve subplot title positioning with proper margins
- Simplified title positioning to use consistent 20px padding above subplot top
- Increased top margin from 5% to 10% when using subplots to accommodate titles
- Removed complex conditional positioning logic
- Ensures titles stay within image bounds (minimum y=15px)
- Follows matplotlib's approach of consistent padding above axes
This fixes the issue where subplot titles were not visible or were being clipped
due to insufficient top margin space.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Render subplot titles directly to image buffer for PNG backend
- Fixed subplot title rendering by using render_text_to_image directly
- Bypassed coordinate transformation that was causing incorrect positioning
- Titles now render properly in screen coordinates above each subplot
- Simplified implementation by removing unused LaTeX processing for now
The issue was that the text() method applies data-to-screen transformation,
but subplot titles need to be positioned in screen coordinates directly.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Clean up subplot title rendering implementation
- Removed debug print statements and boxes
- Simplified implementation for production use
- Subplot titles now render correctly above each subplot
- Using render_text_to_image directly for PNG backend
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Use old library name in CMake example until rename is merged
The main branch still uses 'fortplotlib' as the library name, so the CMake
example needs to use that name when fetching from main. This will be updated
back to 'fortplot' once the rename is merged to main.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* chore: Clean up debug print statements and TODOs
- Removed debug print statements from debug_subplot.f90
- Removed unnecessary print statements from subplot_demo.f90
- Cleaned up TODO comment about LaTeX processing
- Kept error handling print statements (consistent with codebase pattern)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 13b1e48 commit 690b983
File tree
53 files changed
+1157
-227
lines changed- app
- doc
- cmake_example
- design
- fpm_example
- python_example
- example
- fortran
- basic_plots
- colored_contours
- contour_demo
- line_styles
- marker_demo
- pcolormesh_demo
- scale_examples
- unicode_demo
- python
- basic_plots
- colored_contours
- contour_demo
- format_string_demo
- legend_demo
- line_styles
- marker_demo
- pcolormesh_demo
- scale_examples
- streamplot_demo
- python/fortplot
- scripts
- src
- test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
53 files changed
+1157
-227
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
113 | | - | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
125 | | - | |
| 124 | + | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
461 | 461 | | |
462 | 462 | | |
463 | 463 | | |
464 | | - | |
| 464 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
493 | | - | |
| 493 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
| 301 | + | |
0 commit comments