Change linewidth in python plotly px figure - Stack Overflow

fig.update_tracesを使う。

import plotly.express as px

df = px.data.gapminder().query("continent=='Oceania'")
fig = px.line(df, x="year", y="lifeExp", color='country')

# This styles the line
fig.update_traces(line=dict(color="Black", width=0.5))

fig.show()