Display a line chart.
This is syntax-sugar around st.altair_chart. The main difference is this command uses the data's own column and indices to figure out the chart's spec. As a result this is easier to use for many "just plot this" scenarios, while being less customizable.
If st.line_chart does not guess the data specification correctly, try specifying your desired chart using st.altair_chart.
st.line_chart(data=None, *, x=None, y=None, width=0, height=0, use_container_width=True)
data (pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, Iterable, dict or None)
Data to be plotted. Pyarrow tables are not supported by Streamlit's legacy DataFrame serialization (i.e. with config.dataFrameSerialization = "legacy"). To use pyarrow tables, please enable pyarrow by changing the config setting, config.dataFrameSerialization = "arrow".
x (str or None)
Column name to use for the x-axis. If None, uses the data index for the x-axis. This argument can only be supplied by keyword.
y (str, sequence of str, or None)
Column name(s) to use for the y-axis. If a sequence of strings, draws several series on the same chart by melting your wide-format table into a long-format table behind the scenes. If None, draws the data of all remaining columns as data series. This argument can only be supplied by keyword.
The chart width in pixels. If 0, selects the width automatically. This argument can only be supplied by keyword.
The chart height in pixels. If 0, selects the height automatically. This argument can only be supplied by keyword.
If True, set the chart width to the column width. This takes precedence over the width argument. This argument can only be supplied by keyword.
chart_data = pd.DataFrame( np.random.randn(20, 3), columns=['a', 'b', 'c']) st.line_chart(chart_data)(view standalone Streamlit app)