Display an interactive Plotly chart.

Plotly is a charting library for Python. The arguments to this function closely follow the ones for Plotly's plot() function. You can find more about Plotly at https://plot.ly/python.

Function signature

st.plotly_chart(figure_or_data, use_container_width=False, sharing="streamlit", **kwargs)

Parameters

figure_or_data (plotly.graph_objs.Figure, plotly.graph_objs.Data,)

dict/list of plotly.graph_objs.Figure/Data

See https://plot.ly/python/ for examples of graph descriptions.

use_container_width (bool)

If True, set the chart width to the column width. This takes precedence over the figure's native width value.

sharing ({'streamlit', 'private', 'secret', 'public'})

Use 'streamlit' to insert the plot and all its dependencies directly in the Streamlit app using plotly's offline mode (default). Use any other sharing mode to send the chart to Plotly chart studio, which requires an account. See https://plotly.com/chart-studio/ for more information.

**kwargs (null)

Any argument accepted by Plotly's plot() function.

To show Plotly charts in Streamlit, call `st.plotly_chart` (null)

No description

wherever you would call Plotly's `py.plot` or `py.iplot`. (null)

No description

Was this page helpful?

editSuggest edits
forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.