Plotly Graph Text Formatting Issues After Python 3.13.1 Update

Hi everyone,

I’m experiencing an issue with Plotly graph text formatting in Streamlit after updating to Python 3.13.1. The same code was working perfectly in Python 3.12.8.

  • Python: 3.13.1
  • Streamlit: 1.41.1
  • Plotly: 6.0
  • OS: Windows

The text values in the Plotly graph are not being formatted correctly when multiple traces are displayed simultaneously, especially when some periods have no data (null values).

Python 3.13.1

Python 3.12.8

fig7 = px.area(dfLineCargaGrupoMaquinas, x=‘DIA’, y=‘TOTAL_HORAS’,title=titulo,color=“MAQUINA”,text=‘TOTAL_HORAS’,hover_data=[‘TOTAL_HORAS’],line_group=“TIPOMAQ”)
fig7.update_layout(margin=dict(l=20, r=30, t=30, b=0),hovermode=“x”,uniformtext_minsize=8, uniformtext_mode=‘show’,
xaxis=dict(tickmode = ‘auto’,),
xaxis_tickformatstops = [
dict(dtickrange=[“M1”, “M12”], value=“%b '%y M”),
dict(dtickrange=[“M12”, None], value=“%Y Y”) ]

                            )
            
            fig7.update_xaxes(tickmode='linear', tick0=dfLineCargaGrupoMaquinas['DIA'].min(), dtick='M1',tickangle=90)
            fig7.update_traces(mode="lines+markers+text",textposition='top center')
            fig7.add_trace(
            go.Scatter(x=df_unico['DIA'], y=df_unico['HORAS_UTEIS'], mode='lines+markers+text',
                name="Horas Úteis (18.5h)", line=dict(color='blue', dash='dot'),
                text=df_unico['HORAS_UTEIS'],  # Adicionar os valores
                textposition='top center',      # Posição do texto
                hovertemplate='Horas Úteis: %{y}<extra></extra>')
                )
            st.plotly_chart(fig7, use_container_width=True)

I needed to downgrade to Plotly 5.24.1. Now Working