Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -188,15 +188,13 @@ def cross_plot(actual, pred):
|
|
| 188 |
a = pd.Series(actual).astype(float)
|
| 189 |
p = pd.Series(pred).astype(float)
|
| 190 |
|
| 191 |
-
#
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
pad = 0.03 * (hi - lo if hi > lo else 1.0)
|
| 195 |
-
x0, x1 = lo - pad, hi + pad
|
| 196 |
|
| 197 |
fig = go.Figure()
|
| 198 |
|
| 199 |
-
#
|
| 200 |
fig.add_trace(go.Scatter(
|
| 201 |
x=a, y=p, mode="markers",
|
| 202 |
marker=dict(size=6, color=COLORS["pred"]),
|
|
@@ -204,9 +202,9 @@ def cross_plot(actual, pred):
|
|
| 204 |
showlegend=False
|
| 205 |
))
|
| 206 |
|
| 207 |
-
# 1:1 diagonal
|
| 208 |
fig.add_trace(go.Scatter(
|
| 209 |
-
x=[
|
| 210 |
line=dict(color=COLORS["ref"], width=1.2, dash="dash"),
|
| 211 |
hoverinfo="skip", showlegend=False
|
| 212 |
))
|
|
@@ -219,30 +217,32 @@ def cross_plot(actual, pred):
|
|
| 219 |
font=dict(size=FONT_SZ)
|
| 220 |
)
|
| 221 |
|
| 222 |
-
#
|
| 223 |
fig.update_xaxes(
|
| 224 |
title_text="<b>Actual UCS (psi)</b>",
|
| 225 |
title_font=dict(size=18, family="Arial", color="#000"),
|
| 226 |
-
range=[
|
| 227 |
-
ticks="outside",
|
| 228 |
-
tickformat=",.0f",
|
| 229 |
showline=True, linewidth=1.2, linecolor="#444", mirror=True,
|
| 230 |
showgrid=True, gridcolor="rgba(0,0,0,0.12)",
|
| 231 |
-
scaleanchor="y", scaleratio=1,
|
|
|
|
| 232 |
automargin=True
|
| 233 |
)
|
| 234 |
fig.update_yaxes(
|
| 235 |
title_text="<b>Predicted UCS (psi)</b>",
|
| 236 |
title_font=dict(size=18, family="Arial", color="#000"),
|
| 237 |
-
range=[
|
| 238 |
-
ticks="outside",
|
| 239 |
-
tickformat=",.0f",
|
| 240 |
showline=True, linewidth=1.2, linecolor="#444", mirror=True,
|
| 241 |
showgrid=True, gridcolor="rgba(0,0,0,0.12)",
|
|
|
|
| 242 |
automargin=True
|
| 243 |
)
|
|
|
|
| 244 |
return fig
|
| 245 |
|
|
|
|
| 246 |
# ---------- track_plot ----------
|
| 247 |
def track_plot(df, include_actual=True):
|
| 248 |
depth_col = next((c for c in df.columns if 'depth' in str(c).lower()), None)
|
|
|
|
| 188 |
a = pd.Series(actual).astype(float)
|
| 189 |
p = pd.Series(pred).astype(float)
|
| 190 |
|
| 191 |
+
# Fixed extents + identical tick settings
|
| 192 |
+
AX_MIN, AX_MAX = 6000, 10000
|
| 193 |
+
TICK0, DTICK = 6000, 1000
|
|
|
|
|
|
|
| 194 |
|
| 195 |
fig = go.Figure()
|
| 196 |
|
| 197 |
+
# Points
|
| 198 |
fig.add_trace(go.Scatter(
|
| 199 |
x=a, y=p, mode="markers",
|
| 200 |
marker=dict(size=6, color=COLORS["pred"]),
|
|
|
|
| 202 |
showlegend=False
|
| 203 |
))
|
| 204 |
|
| 205 |
+
# 1:1 reference line (full diagonal)
|
| 206 |
fig.add_trace(go.Scatter(
|
| 207 |
+
x=[AX_MIN, AX_MAX], y=[AX_MIN, AX_MAX], mode="lines",
|
| 208 |
line=dict(color=COLORS["ref"], width=1.2, dash="dash"),
|
| 209 |
hoverinfo="skip", showlegend=False
|
| 210 |
))
|
|
|
|
| 217 |
font=dict(size=FONT_SZ)
|
| 218 |
)
|
| 219 |
|
| 220 |
+
# Make the two axes identical: same range, same ticks, same aspect
|
| 221 |
fig.update_xaxes(
|
| 222 |
title_text="<b>Actual UCS (psi)</b>",
|
| 223 |
title_font=dict(size=18, family="Arial", color="#000"),
|
| 224 |
+
range=[AX_MIN, AX_MAX],
|
| 225 |
+
tick0=TICK0, dtick=DTICK, tickformat=",.0f", ticks="outside",
|
|
|
|
| 226 |
showline=True, linewidth=1.2, linecolor="#444", mirror=True,
|
| 227 |
showgrid=True, gridcolor="rgba(0,0,0,0.12)",
|
| 228 |
+
scaleanchor="y", scaleratio=1, # lock aspect to keep 45° line exact
|
| 229 |
+
fixedrange=True, # keep the range fixed (no zoom/pan)
|
| 230 |
automargin=True
|
| 231 |
)
|
| 232 |
fig.update_yaxes(
|
| 233 |
title_text="<b>Predicted UCS (psi)</b>",
|
| 234 |
title_font=dict(size=18, family="Arial", color="#000"),
|
| 235 |
+
range=[AX_MIN, AX_MAX],
|
| 236 |
+
tick0=TICK0, dtick=DTICK, tickformat=",.0f", ticks="outside",
|
|
|
|
| 237 |
showline=True, linewidth=1.2, linecolor="#444", mirror=True,
|
| 238 |
showgrid=True, gridcolor="rgba(0,0,0,0.12)",
|
| 239 |
+
fixedrange=True, # same fixed range
|
| 240 |
automargin=True
|
| 241 |
)
|
| 242 |
+
|
| 243 |
return fig
|
| 244 |
|
| 245 |
+
|
| 246 |
# ---------- track_plot ----------
|
| 247 |
def track_plot(df, include_actual=True):
|
| 248 |
depth_col = next((c for c in df.columns if 'depth' in str(c).lower()), None)
|