Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,7 @@ COLORS = {"pred": "#1f77b4", "actual": "#f2b702", "ref": "#5a5a5a"}
|
|
| 27 |
CROSS_W = 500; CROSS_H = 500 # square cross-plot (Build + Validate)
|
| 28 |
TRACK_W = 400; TRACK_H = 950 # log-strip style (all pages)
|
| 29 |
FONT_SZ = 15
|
| 30 |
-
PLOT_COLS = [30, 1,
|
| 31 |
CROSS_NUDGE = 0.06 # push cross-plot to the RIGHT inside its band:
|
| 32 |
# inner columns [CROSS_NUDGE : 1] → bigger = more right
|
| 33 |
|
|
@@ -176,6 +176,7 @@ def cross_plot(actual, pred):
|
|
| 176 |
|
| 177 |
fig = go.Figure()
|
| 178 |
|
|
|
|
| 179 |
fig.add_trace(go.Scatter(
|
| 180 |
x=a, y=p, mode="markers",
|
| 181 |
marker=dict(size=6, color=COLORS["pred"]),
|
|
@@ -183,7 +184,7 @@ def cross_plot(actual, pred):
|
|
| 183 |
showlegend=False
|
| 184 |
))
|
| 185 |
|
| 186 |
-
#
|
| 187 |
fig.add_trace(go.Scatter(
|
| 188 |
x=[fixed_min, fixed_max], y=[fixed_min, fixed_max], mode="lines",
|
| 189 |
line=dict(color=COLORS["ref"], width=1.2, dash="dash"),
|
|
@@ -196,32 +197,31 @@ def cross_plot(actual, pred):
|
|
| 196 |
margin=dict(l=64, r=18, t=10, b=48),
|
| 197 |
hovermode="closest",
|
| 198 |
font=dict(size=FONT_SZ),
|
| 199 |
-
dragmode=
|
| 200 |
)
|
| 201 |
|
| 202 |
-
# Apply fixed range and identical ticks
|
| 203 |
fig.update_xaxes(
|
| 204 |
title_text="<b>Actual UCS (psi)</b>",
|
| 205 |
range=[fixed_min, fixed_max],
|
| 206 |
tickformat=",.0f", ticks="outside",
|
| 207 |
showline=True, linewidth=1.2, linecolor="#444", mirror=True,
|
| 208 |
-
showgrid=True, gridcolor="rgba(0,0,0,0.12)",
|
|
|
|
| 209 |
)
|
|
|
|
| 210 |
fig.update_yaxes(
|
| 211 |
title_text="<b>Predicted UCS (psi)</b>",
|
| 212 |
range=[fixed_min, fixed_max],
|
| 213 |
tickformat=",.0f", ticks="outside",
|
| 214 |
showline=True, linewidth=1.2, linecolor="#444", mirror=True,
|
| 215 |
showgrid=True, gridcolor="rgba(0,0,0,0.12)",
|
| 216 |
-
scaleanchor="x", scaleratio=1,
|
|
|
|
| 217 |
)
|
| 218 |
|
| 219 |
return fig
|
| 220 |
|
| 221 |
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
def track_plot(df, include_actual=True):
|
| 226 |
depth_col = next((c for c in df.columns if 'depth' in str(c).lower()), None)
|
| 227 |
if depth_col is not None:
|
|
|
|
| 27 |
CROSS_W = 500; CROSS_H = 500 # square cross-plot (Build + Validate)
|
| 28 |
TRACK_W = 400; TRACK_H = 950 # log-strip style (all pages)
|
| 29 |
FONT_SZ = 15
|
| 30 |
+
PLOT_COLS = [30, 1, 20] # 3-column band: left • spacer • right (Build + Validate)
|
| 31 |
CROSS_NUDGE = 0.06 # push cross-plot to the RIGHT inside its band:
|
| 32 |
# inner columns [CROSS_NUDGE : 1] → bigger = more right
|
| 33 |
|
|
|
|
| 176 |
|
| 177 |
fig = go.Figure()
|
| 178 |
|
| 179 |
+
# Scatter points
|
| 180 |
fig.add_trace(go.Scatter(
|
| 181 |
x=a, y=p, mode="markers",
|
| 182 |
marker=dict(size=6, color=COLORS["pred"]),
|
|
|
|
| 184 |
showlegend=False
|
| 185 |
))
|
| 186 |
|
| 187 |
+
# 1:1 reference line from bottom-left to top-right
|
| 188 |
fig.add_trace(go.Scatter(
|
| 189 |
x=[fixed_min, fixed_max], y=[fixed_min, fixed_max], mode="lines",
|
| 190 |
line=dict(color=COLORS["ref"], width=1.2, dash="dash"),
|
|
|
|
| 197 |
margin=dict(l=64, r=18, t=10, b=48),
|
| 198 |
hovermode="closest",
|
| 199 |
font=dict(size=FONT_SZ),
|
| 200 |
+
dragmode=False # disables zooming
|
| 201 |
)
|
| 202 |
|
|
|
|
| 203 |
fig.update_xaxes(
|
| 204 |
title_text="<b>Actual UCS (psi)</b>",
|
| 205 |
range=[fixed_min, fixed_max],
|
| 206 |
tickformat=",.0f", ticks="outside",
|
| 207 |
showline=True, linewidth=1.2, linecolor="#444", mirror=True,
|
| 208 |
+
showgrid=True, gridcolor="rgba(0,0,0,0.12)",
|
| 209 |
+
automargin=True, fixedrange=True # disables zooming
|
| 210 |
)
|
| 211 |
+
|
| 212 |
fig.update_yaxes(
|
| 213 |
title_text="<b>Predicted UCS (psi)</b>",
|
| 214 |
range=[fixed_min, fixed_max],
|
| 215 |
tickformat=",.0f", ticks="outside",
|
| 216 |
showline=True, linewidth=1.2, linecolor="#444", mirror=True,
|
| 217 |
showgrid=True, gridcolor="rgba(0,0,0,0.12)",
|
| 218 |
+
scaleanchor="x", scaleratio=1,
|
| 219 |
+
automargin=True, fixedrange=True # disables zooming
|
| 220 |
)
|
| 221 |
|
| 222 |
return fig
|
| 223 |
|
| 224 |
|
|
|
|
|
|
|
|
|
|
| 225 |
def track_plot(df, include_actual=True):
|
| 226 |
depth_col = next((c for c in df.columns if 'depth' in str(c).lower()), None)
|
| 227 |
if depth_col is not None:
|