Plotly image not showing on Streamlit

I want to add an image as a watermark on my plotly charts. Running the code below in a notebook works fine, but on Streamlit the image doesn’t show:

import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(go.Scatter(x=[0, 0.5, 1, 2, 19], y=[1.23, 2.5, 0.42, 3, 1]))

fig.add_layout_image(
        dict(
            source="https://i0.wp.com/scannerdabolsa.com.br/wp-content/uploads/2021/03/cropped-LOGO-SCANNER-DA-BOLSA.jpg",
            xref="paper",
            yref="paper",
            x=0.5,
            y=1,
            sizex=0.5,
            sizey=0.5,
            #sizing="stretch",
            opacity=0.5,
            layer="below")
)


st.plotly_chart(fig, use_container_width=True)   


Hi @eduardot80, welcome to the community!

What versions of plotly and streamlit are you using? The image as watermark appears in Streamlit when I run your code. The code works with streamlit==1.11.0 and plotly==5.8.2.

If you’re using older versions, I would suggest upgrading to the above versions.

Hi snehankekre, thanks for the help!

I upgraded to streamlit==1.11.0 and plotly==5.9.0 but still have the problem. Also deployed to heroku and the image doesn’t show there either. This is really weird because apart from that, every plotly chart I have built works fine.

It would help if you could share a GitHub repo with the size code and a link to the streamlit cloud app.