Open EwoutH opened 3 months ago
To help Streamlit prioritize this feature, react with a 👍 (thumbs up emoji) to the initial post.
Your vote helps us identify which enhancements matter most to our users.
I now see Vega-Lite is used under the hood, not Plotly. With Vega-Lite it might be a bit more complex.
But it would still be useful.
Thanks for the feature request! Just for context, we're trying to keep st.scatter_chart
and all other built-in charting commands relatively minimal, since we don't want to invent yet another plotting framework. For more complex charts, it's recommended to use Altair or Plotly itself with st.altair_chart
or st.plotly_chart
. But will keep this open, and if lots of people want it, we might consider it!
Checklist
Summary
Add support for trendlines in Streamlit's scatter_chart, similar to Plotly's trendline functionality. This feature would allow users to easily add linear or non-linear trendlines to their scatter charts.
Why?
Currently, Streamlit's
scatter_chart
does not support the addition of trendlines, which limits its functionality for users who need to analyze data trends. Trendlines are essential for visualizing relationships between variables, identifying patterns, and making predictions. Adding this feature would bring Streamlit's visualization capabilities closer to those of Plotly Express, making it more powerful and versatile for data analysis.How?
The solution would involve modifying the
scatter_chart
function in Streamlit to accept atrendline
argument, similar to how Plotly Express handles it. This argument could accept values like"ols"
for Ordinary Least Squares regression,"lowess"
for Locally Weighted Scatterplot Smoothing, and possibly other options for moving averages or exponential smoothing.Additional Context
See the Plotly docs: