Skip to content

Commit de68a75

Browse files
fix(letsplot): address review feedback for column-stratigraphic
Attempt 2/3 - fixes based on AI review
1 parent 90bff84 commit de68a75

1 file changed

Lines changed: 28 additions & 22 deletions

File tree

plots/column-stratigraphic/implementations/letsplot.py

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" pyplots.ai
1+
"""pyplots.ai
22
column-stratigraphic: Stratigraphic Column with Lithology Patterns
33
Library: letsplot 4.9.0 | Python 3.14.3
44
Quality: 82/100 | Created: 2026-03-15
@@ -165,12 +165,6 @@
165165
age_df = pd.DataFrame(age_labels)
166166
bracket_df = pd.DataFrame(age_brackets)
167167

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-
174168
# Unconformity wavy line at Jurassic/Cretaceous boundary (110m)
175169
wavy_x = []
176170
wavy_y = []
@@ -193,11 +187,13 @@
193187
size=1.0,
194188
alpha=0.8,
195189
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")
197195
.line("Depth: @top\u2013@bottom m")
198-
.line("Thickness: @thickness m")
199-
.line("Formation: @formation")
200-
.line("Age: @age"),
196+
.line("Thickness: @thickness m"),
201197
)
202198
)
203199

@@ -206,24 +202,34 @@
206202
plot = plot + geom_segment(
207203
aes(x="x", y="y", xend="xend", yend="yend"),
208204
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,
212208
show_legend=False,
213209
)
214210

215211
if pattern_dot_df is not None and len(pattern_dot_df) > 0:
216212
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
218214
)
219215

220216
if pattern_circle_df is not None and len(pattern_circle_df) > 0:
221217
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
223219
)
224220

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+
)
227233

228234
# Age boundary dashed lines (non-unconformity)
229235
non_unconformity_boundaries = pd.DataFrame(
@@ -244,19 +250,19 @@
244250
)
245251

246252
# 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)
248254

249255
# 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")
251257

252258
# Scales and theme
253259
plot = (
254260
plot
255261
+ scale_fill_manual(values=lithology_colors, name="Lithology", limits=lithology_order)
256262
+ scale_y_reverse()
257-
+ scale_x_continuous(limits=[-0.35, 1.65])
258263
+ 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()
260266
+ theme(
261267
plot_title=element_text(size=24, face="bold", color="#1A1A1A"),
262268
axis_title_y=element_text(size=20, color="#333333"),

0 commit comments

Comments
 (0)