|
1 | | -""" pyplots.ai |
| 1 | +"""pyplots.ai |
2 | 2 | column-stratigraphic: Stratigraphic Column with Lithology Patterns |
3 | 3 | Library: letsplot 4.9.0 | Python 3.14.3 |
4 | 4 | Quality: 82/100 | Created: 2026-03-15 |
|
165 | 165 | age_df = pd.DataFrame(age_labels) |
166 | 166 | bracket_df = pd.DataFrame(age_brackets) |
167 | 167 |
|
168 | | -# Age boundary dashed lines |
169 | | -age_boundary_depths = [35, 110, 195] |
170 | | -boundaries_df = pd.DataFrame( |
171 | | - {"x": [-0.02] * 3, "y": age_boundary_depths, "xend": [1.02] * 3, "yend": age_boundary_depths} |
172 | | -) |
173 | | - |
174 | 168 | # Unconformity wavy line at Jurassic/Cretaceous boundary (110m) |
175 | 169 | wavy_x = [] |
176 | 170 | wavy_y = [] |
|
193 | 187 | size=1.0, |
194 | 188 | alpha=0.8, |
195 | 189 | tooltips=layer_tooltips() |
196 | | - .line("@lithology") |
| 190 | + .format("@top", ".0f") |
| 191 | + .format("@bottom", ".0f") |
| 192 | + .format("@thickness", ".0f") |
| 193 | + .title("@formation") |
| 194 | + .line("@lithology | @age") |
197 | 195 | .line("Depth: @top\u2013@bottom m") |
198 | | - .line("Thickness: @thickness m") |
199 | | - .line("Formation: @formation") |
200 | | - .line("Age: @age"), |
| 196 | + .line("Thickness: @thickness m"), |
201 | 197 | ) |
202 | 198 | ) |
203 | 199 |
|
|
206 | 202 | plot = plot + geom_segment( |
207 | 203 | aes(x="x", y="y", xend="xend", yend="yend"), |
208 | 204 | data=pattern_seg_df, |
209 | | - color="#3C3C3C", |
210 | | - size=0.4, |
211 | | - alpha=0.55, |
| 205 | + color="#2A2A2A", |
| 206 | + size=0.5, |
| 207 | + alpha=0.7, |
212 | 208 | show_legend=False, |
213 | 209 | ) |
214 | 210 |
|
215 | 211 | if pattern_dot_df is not None and len(pattern_dot_df) > 0: |
216 | 212 | plot = plot + geom_point( |
217 | | - aes(x="x", y="y"), data=pattern_dot_df, color="#5C4A1E", size=1.2, alpha=0.5, shape=16, show_legend=False |
| 213 | + aes(x="x", y="y"), data=pattern_dot_df, color="#4A3A10", size=1.5, alpha=0.65, shape=16, show_legend=False |
218 | 214 | ) |
219 | 215 |
|
220 | 216 | if pattern_circle_df is not None and len(pattern_circle_df) > 0: |
221 | 217 | plot = plot + geom_point( |
222 | | - aes(x="x", y="y"), data=pattern_circle_df, color="#6B3A3A", size=4, alpha=0.45, shape=1, show_legend=False |
| 218 | + aes(x="x", y="y"), data=pattern_circle_df, color="#5A2A2A", size=4.5, alpha=0.65, shape=1, show_legend=False |
223 | 219 | ) |
224 | 220 |
|
225 | | -# Unconformity wavy line at 110m |
226 | | -plot = plot + geom_line(aes(x="x", y="y"), data=wavy_df, color="#C44E52", size=1.2, show_legend=False) |
| 221 | +# Unconformity wavy line at 110m with label |
| 222 | +plot = plot + geom_line(aes(x="x", y="y"), data=wavy_df, color="#C44E52", size=1.5, show_legend=False) |
| 223 | +unconformity_label = pd.DataFrame({"x": [1.08], "y": [110], "label": ["Unconformity"]}) |
| 224 | +plot = plot + geom_text( |
| 225 | + aes(x="x", y="y", label="label"), |
| 226 | + data=unconformity_label, |
| 227 | + color="#C44E52", |
| 228 | + size=12, |
| 229 | + fontface="bold", |
| 230 | + hjust=0, |
| 231 | + show_legend=False, |
| 232 | +) |
227 | 233 |
|
228 | 234 | # Age boundary dashed lines (non-unconformity) |
229 | 235 | non_unconformity_boundaries = pd.DataFrame( |
|
244 | 250 | ) |
245 | 251 |
|
246 | 252 | # Formation labels (right side) |
247 | | -plot = plot + geom_text(aes(x="x", y="y", label="label"), data=form_df, size=12, color="#2C2C2C", hjust=0) |
| 253 | +plot = plot + geom_text(aes(x="x", y="y", label="label"), data=form_df, size=14, color="#2C2C2C", hjust=0) |
248 | 254 |
|
249 | 255 | # Age labels (left side) |
250 | | -plot = plot + geom_text(aes(x="x", y="y", label="label"), data=age_df, size=13, color="#2C2C2C", fontface="italic") |
| 256 | +plot = plot + geom_text(aes(x="x", y="y", label="label"), data=age_df, size=15, color="#2C2C2C", fontface="italic") |
251 | 257 |
|
252 | 258 | # Scales and theme |
253 | 259 | plot = ( |
254 | 260 | plot |
255 | 261 | + scale_fill_manual(values=lithology_colors, name="Lithology", limits=lithology_order) |
256 | 262 | + scale_y_reverse() |
257 | | - + scale_x_continuous(limits=[-0.35, 1.65]) |
258 | 263 | + labs(title="column-stratigraphic \u00b7 letsplot \u00b7 pyplots.ai", y="Depth (m)", x="") |
259 | | - + theme_minimal() |
| 264 | + + scale_x_continuous(limits=[-0.35, 1.65]) |
| 265 | + + flavor_high_contrast_light() |
260 | 266 | + theme( |
261 | 267 | plot_title=element_text(size=24, face="bold", color="#1A1A1A"), |
262 | 268 | axis_title_y=element_text(size=20, color="#333333"), |
|
0 commit comments