# Plotly\_chart theme="streamlit" documentation

**URL:** <https://discuss.streamlit.io/t/plotly-chart-theme-streamlit-documentation/36476>\
**Category:** Using Streamlit\
**Tags:** plotly\
**Created:** [January 22, 2023, 8:20pm UTC](https://discuss.streamlit.io/t/plotly-chart-theme-streamlit-documentation/36476 "2023-01-22T20:20:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![justgri](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/justgri/32/33069_2.png) [@justgri](https://discuss.streamlit.io/u/justgri)\
**Post date:** [January 22, 2023, 8:20pm UTC](https://discuss.streamlit.io/t/plotly-chart-theme-streamlit-documentation/36476/1 "2023-01-22T20:20:54Z")

</div>

Is there a documentation for exact parameters used in Streamlit theme for Plotly charts (e.g., title/axis title font, font size, position, chart color scheme, margins, etc.)?

I saw the documentation page with examples ([https://plotly.streamlit.app/](https://plotly.streamlit.app/)), but I couldn’t find the code for how the Streamlit theme itself is configured.

One specific property I can’t figure out is the space between plot border and axes. How is y=0 treated in the screenshot below? It’s not taking the blue color from the gridcolor argument, nor the thicker black from the showline argument.

See screenshot and code below - the exact same code was used to produce both charts except for theme=“streamlit” and theme=None (and titles accordingly).

Thank you for your help!

Justinas

 ![streamlit theme example](https://global.discourse-cdn.com/streamlit/original/3X/7/1/713523d7bf5c3425ed6d9db0374c90dad8fcbc7c.png)

```auto
    fig = go.Figure()
    fig.add_trace(
        go.Scatter(
            x=[0, 1, 2, 3, 4],
            y=[0, 2, 4, 2, 0],
            line=dict(color="green", width=4),
        )
    )
    fig.update_layout(
        title="streamlit themed chart",
        yaxis_title="y-value",
        xaxis_title="x-value",
        paper_bgcolor="rgba(213,213, 213,50)",
        plot_bgcolor="rgba(255,220,220,50)",
        yaxis_range=[0, 6],
        xaxis_range=[0, 6],
    )

    fig.update_xaxes(showline=True, linewidth=2, linecolor="black")

    fig.update_yaxes(
        showline=True,
        linewidth=2,
        linecolor="black",
        gridwidth=1,
        gridcolor="blue",
    )
    st.plotly_chart(fig, theme="streamlit", use_container_width=True)

```

---

<div class="post-metadata">

**Author:** ![jptfs](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/jptfs/32/54040_2.png) [@jptfs](https://discuss.streamlit.io/u/jptfs)\
**Post date:** [November 1, 2023, 2:55pm UTC](https://discuss.streamlit.io/t/plotly-chart-theme-streamlit-documentation/36476/2 "2023-11-01T14:55:33Z")

</div>

Any update on this? I am hoping to find the source code for the plotly theme too so I know which font/family is being used as well as the bg colors.

---

<div class="post-metadata">

**Author:** ![dataprofessor](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/dataprofessor/32/44163_2.png) [@dataprofessor](https://discuss.streamlit.io/u/dataprofessor)\
**Post date:** [November 1, 2023, 3:35pm UTC](https://discuss.streamlit.io/t/plotly-chart-theme-streamlit-documentation/36476/3 "2023-11-01T15:35:23Z")

</div>

Hi @justgri @jptfs

I found this on Streamlit’s GitHub repo for the Streamlit plotly theme that you may get some inspiration from

> <https://github.com/streamlit/streamlit/blob/6a1521bd323a80be49d622c47f1d42615a88c4b1/lib/streamlit/elements/lib/streamlit_plotly_theme.py>

---

<div class="post-metadata">

**Author:** ![jptfs](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/jptfs/32/54040_2.png) [@jptfs](https://discuss.streamlit.io/u/jptfs)\
**Post date:** [November 1, 2023, 3:50pm UTC](https://discuss.streamlit.io/t/plotly-chart-theme-streamlit-documentation/36476/4 "2023-11-01T15:50:04Z")

</div>

I did find this as well just a few minutes ago, but I am left with questions on how the colors are actually populated. For example, if I create this theme in my IDE and run outside of streamlit - the plots are all black (due to the global CATEGORY\_\_ and SEQUENTIAL\_\_ variables being set of the form #000001 and so on).

Line 27 says `# We pass in temporary colors to the frontend and the frontend will replace`  
I guess I don’t understand what is happening here.

---

<div class="post-metadata">

**Author:** ![willhuang](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/willhuang/32/8445_2.png) [@willhuang](https://discuss.streamlit.io/u/willhuang)\
**Post date:** [November 1, 2023, 5:48pm UTC](https://discuss.streamlit.io/t/plotly-chart-theme-streamlit-documentation/36476/5 "2023-11-01T17:48:10Z")

</div>

Hi @jptfs and @justgri , so what happens is Streamlit creates its own plotly theme on the python side and then we pass that theme to the plotly javascript code.

In order to find the actual values that streamlit is using, you can check it here:

> <https://github.com/streamlit/streamlit/blob/develop/frontend/lib/src/components/elements/PlotlyChart/CustomTheme.tsx>

where the actual values in `CustomTheme.tsx` get mapped to this file:

> <https://github.com/streamlit/streamlit/tree/develop/frontend/lib/src/theme/primitives>
>
> //github.com/streamlit/streamlit/tree/develop/frontend/lib/src/theme/primitives

If there are some things that the streamlit theme is not respecting, that is a bug and would love a report here:

> **[Issues · streamlit/streamlit](https://github.com/streamlit/streamlit/issues)**
>
> Streamlit — A faster way to build and share data apps. - Issues · streamlit/streamlit

---

<div class="post-metadata">

**Author:** ![jptfs](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/jptfs/32/54040_2.png) [@jptfs](https://discuss.streamlit.io/u/jptfs)\
**Post date:** [November 1, 2023, 6:02pm UTC](https://discuss.streamlit.io/t/plotly-chart-theme-streamlit-documentation/36476/6 "2023-11-01T18:02:19Z")

</div>

Those are the references I was looking for - thanks!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [November 6, 2023, 10:01am UTC](https://discuss.streamlit.io/t/plotly-chart-theme-streamlit-documentation/36476/7 "2023-11-06T10:01:56Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
