Summary
My app includes many plotly graphs using st.plotly_chart
. I am now auto-using the streamlit theme since I like how it looks. However, I am finding it impossible to adjust any of the title or axis labels, in terms of size, colour, position, etc. I want to keep using the streamlit theme because it looks much much better than the plotly themes. But, it’s very important that I can control the size, colour, placement, etc. otherwise the theme is unusable.
Steps to reproduce
Code snippet:
fig.update_layout(title=dict(font=dict(size=40)))
fig.update_layout(title_font_size=40)
fig.update_layout(
title={
'text': "Plot Title",
'y':0.9,
'x':0.9,
'xanchor': 'right',
'yanchor': 'top'})
fig.update_layout(
title="Plot Title",
xaxis_title="X Axis Title",
yaxis_title="Y Axis Title",
legend_title="Legend Title",
font=dict(
family="Courier New, monospace",
size=18,
color="RebeccaPurple"
)
)
fig.update_layout(
title=dict(
text='<b>Life Expectancy - Our World in Data</b>',
x=0.5,
y=0.95,
font=dict(
family="Arial",
size=20,
color='#000000'
)
))
fig.update_layout(font={'size': 30})
Above are several example of the many types of updates I have tried to make to the layout in order to make any type of change, but it’s not working.
Expected behavior:
I expect that the title would be adjusted according to the normal plotly methods of updating labels.
Actual behavior:
Nothing is modified in my title or labels. The only thing that actually gets updated is my custom range selector of buttons (which I really don’t care about modifying). The text colour still stays as the textColor
I have set in my config.toml
file.
Debug info
- Streamlit version: 1.17.0
- Python version: 3.8.13
- Conda
- OS version: Mac
- Browser version: Chrome/safari
Requirements file
altair==4.2.0
bokeh==3.0.3
boto3==1.24.28
nltk==3.7
pandas==1.4.4
plotly==5.9.0
vega_datasets==0.7.0
streamlit==1.17.0
Links
- Link to your GitHub repo: private
- Link to your deployed app: private