I made a scatter plot with plotly_express.
It didn’t look good. So I wondered how to change the theme.
It took me way too long to figure out.
First I looked through the documentation here. I didn’t seem to see any relevant source code. Instead was a bunch of stuff about creating a new theme. Not useful.
Finally I found code like
fig.layout.template = 'plotly_dark' buried in an image. Turns out that’s how you do it.
So. It’s a two step process:
- Save your plot to a variable: e.g.
fig = px.scatter(df, x='x', y='y', color='clr').
fig.layout.template = 'theme_here'. Obviously change
theme_hereto one of the plotly themes: