Plotly templates don't work properly

It seems that plotly’s templates don’t render properly in streamlit. The graphs change, but only the default template seems to work properly. Try running the below code, taken from plotly’s documentation: Theming and templates | Python | Plotly

import streamlit as st
import plotly.express as px

df = px.data.gapminder()
df_2007 = df.query("year==2007")

for template in ["plotly", "plotly_white", "plotly_dark", "ggplot2", "seaborn", "simple_white", "none"]:
    fig = px.scatter(df_2007,
                     x="gdpPercap", y="lifeExp", size="pop", color="continent",
                     log_x=True, size_max=60,
                     template=template, title="Gapminder 2007: '%s' theme" % template)
    st.plotly_chart(fig)

I’m happy to look into this but don’t know where to start!

Ditto. Exact same code.

Hey @apassy @lklein

True, it seems some but not all specs from the template are passed, probably due to how Plotly specifications are sent from the backend to the frontend.

Could you open an issue so we can keep track of it? Thanks a lot for your help!

Fanilo