Commit 569cbd3
fix: ensure backend is initialized to prevent first plot rendering empty (#359)
## Summary
Fixes Issue #355 where the first plot appeared empty on GitHub Pages.
The issue was caused by the backend not being initialized during the
`figure()` call, which led to plot_count being reset when
`ensure_global_figure_initialized()` was called later.
## Problem
The bug occurred because:
1. `figure()` called `fig%initialize()` without backend parameter
2. Backend remained unallocated
3. Later calls (`plot`, `title`, etc.) checked if backend was allocated
4. Since it wasn't, they called `initialize()` again, resetting
plot_count to 0
5. This caused the first plot data to be lost, resulting in only black
dots being rendered
## Solution
- Initialize default PNG backend in `figure_t%initialize()` if not
specified
- Add default color initialization to `plot_data_t` type (both versions)
- Add test to verify first plot renders with correct colors
## Test
Added `test_first_plot_rendering.f90` which verifies that the first plot
renders with proper colors (not just dots).
Fixes #355
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 457fe60 commit 569cbd3
File tree
9 files changed
+1127
-2130
lines changed- src
- test
9 files changed
+1127
-2130
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| |||
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| 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 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
| 35 | + | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
92 | 64 | | |
93 | 65 | | |
94 | 66 | | |
| |||
102 | 74 | | |
103 | 75 | | |
104 | 76 | | |
105 | | - | |
106 | | - | |
| 77 | + | |
| 78 | + | |
107 | 79 | | |
108 | 80 | | |
109 | 81 | | |
110 | 82 | | |
111 | | - | |
| 83 | + | |
112 | 84 | | |
113 | 85 | | |
114 | 86 | | |
115 | 87 | | |
116 | 88 | | |
117 | | - | |
| 89 | + | |
118 | 90 | | |
119 | 91 | | |
120 | 92 | | |
| |||
142 | 114 | | |
143 | 115 | | |
144 | 116 | | |
145 | | - | |
| 117 | + | |
146 | 118 | | |
147 | 119 | | |
148 | 120 | | |
| |||
163 | 135 | | |
164 | 136 | | |
165 | 137 | | |
166 | | - | |
| 138 | + | |
167 | 139 | | |
168 | 140 | | |
169 | 141 | | |
| |||
186 | 158 | | |
187 | 159 | | |
188 | 160 | | |
189 | | - | |
| 161 | + | |
190 | 162 | | |
191 | 163 | | |
192 | 164 | | |
| |||
0 commit comments