Skip to content

Commit 5715b51

Browse files
Fix TypeError: split update_layout axis kwargs into update_xaxes/update_yaxes
1 parent d478357 commit 5715b51

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

app.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""
1+
"""
22
═══════════════════════════════════════════════════════════════════════════════
33
United Passing Efficiency — Streamlit App
44
Autor : Álvaro Salinas Ortiz | github.com/alvarosalinaso
@@ -366,9 +366,9 @@ def load_data() -> tuple:
366366
**PLOTLY_THEME,
367367
title=f"Distribución de pases progresivos — {hm_player}",
368368
height=400,
369-
xaxis=dict(side="top", tickfont=dict(size=11, color="#8b949e"), gridcolor="rgba(0,0,0,0)"),
370-
yaxis=dict(tickfont=dict(size=11, color="#8b949e"), gridcolor="rgba(0,0,0,0)"),
371369
)
370+
fig_hm.update_xaxes(side="top", tickfont=dict(size=11, color="#8b949e"), gridcolor="rgba(0,0,0,0)")
371+
fig_hm.update_yaxes(tickfont=dict(size=11, color="#8b949e"), gridcolor="rgba(0,0,0,0)")
372372
st.plotly_chart(fig_hm, use_container_width=True)
373373

374374
st.markdown("#### ⚡ Expected Threat (xT) generado por zona")
@@ -385,9 +385,9 @@ def load_data() -> tuple:
385385
hovertemplate="Zona: %{x}<br>Sector: %{y}<br>xT: %{z:.3f}<extra></extra>",
386386
))
387387
fig_xt.update_layout(**PLOTLY_THEME, height=360,
388-
title=f"Expected Threat generado — {hm_player}",
389-
xaxis=dict(side="top", tickfont=dict(size=11, color="#8b949e"), gridcolor="rgba(0,0,0,0)"),
390-
yaxis=dict(tickfont=dict(size=11, color="#8b949e"), gridcolor="rgba(0,0,0,0)"))
388+
title=f"Expected Threat generado — {hm_player}")
389+
fig_xt.update_xaxes(side="top", tickfont=dict(size=11, color="#8b949e"), gridcolor="rgba(0,0,0,0)")
390+
fig_xt.update_yaxes(tickfont=dict(size=11, color="#8b949e"), gridcolor="rgba(0,0,0,0)")
391391
st.plotly_chart(fig_xt, use_container_width=True)
392392

393393

@@ -458,11 +458,11 @@ def load_data() -> tuple:
458458
fig_net.update_layout(
459459
**PLOTLY_THEME,
460460
height=500,
461-
xaxis=dict(range=[20, 100], showgrid=False, zeroline=False, showticklabels=False),
462-
yaxis=dict(range=[0, 105], showgrid=False, zeroline=False, showticklabels=False),
463461
showlegend=False,
464462
title="Red de pases — Mediocampo Manchester United 2024-25",
465463
)
464+
fig_net.update_xaxes(range=[20, 100], showgrid=False, zeroline=False, showticklabels=False)
465+
fig_net.update_yaxes(range=[0, 105], showgrid=False, zeroline=False, showticklabels=False)
466466
fig_net.update_layout(shapes=field_shapes)
467467
st.plotly_chart(fig_net, use_container_width=True)
468468

@@ -512,9 +512,9 @@ def load_data() -> tuple:
512512
title=f"{metric_evo_label} — Evolución por jornada (media móvil 5 partidos)",
513513
height=420,
514514
legend=dict(orientation="h", y=-0.15, x=0),
515-
xaxis=dict(title="Jornada"),
516-
yaxis=dict(title=metric_evo_label),
517515
)
516+
fig_evo.update_xaxes(title="Jornada")
517+
fig_evo.update_yaxes(title=metric_evo_label)
518518
st.plotly_chart(fig_evo, use_container_width=True)
519519

520520

@@ -527,3 +527,4 @@ def load_data() -> tuple:
527527
<a href='https://www.linkedin.com/in/alvaro-salinas-ortiz/' style='color:#58a6ff;'>LinkedIn</a>
528528
</div>
529529
""", unsafe_allow_html=True)
530+

0 commit comments

Comments
 (0)