I’m building a Streamlit dashboard using Plotly and one of my charts is rendering the word undefined between the chart title and the y-axis. It appears where the axis title would normally be.
I apply a common layout theme to all figures:
BASE = dict(
paper_bgcolor="rgba(0,0,0,0)",
plot_bgcolor="rgba(0,0,0,0)",
font=dict(family="Inter", size=11),
title_font=dict(family="Syne", size=13),
)
def T(fig):
fig.update_layout(**BASE)
return fig
Example chart:
fig = go.Figure(
go.Waterfall(
x=rev_yr["fiscal_year"],
y=wf_y,
measure=wf_measure,
)
)
fig = T(fig)
st.plotly_chart(fig, use_container_width=True)
Things I’ve tried
Removing axis titles:
fig.update_yaxes(title=None)
fig.update_layout(yaxis_title=None)
Also tried clearing axis titles inside a helper function:
for axis in fig.layout:
if axis.startswith("xaxis") or axis.startswith("yaxis"):
fig.layout[axis].title = None
However the undefined label still appears.
What causes Plotly to render undefined as an axis label, and how can it be removed globally?
Is this related to Plotly’s handling of None titles or layout defaults?
Environment: Python 3.11, Streamlit, Plotly
