Spaces:
Sleeping
Sleeping
File size: 7,702 Bytes
746d2f1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
---
title: Chart elements
slug: /develop/api-reference/charts
---
# Chart elements
Streamlit supports several different charting libraries, and our goal is to
continually add support for more. Right now, the most basic library in our
arsenal is [Matplotlib](https://matplotlib.org/). Then there are also
interactive charting libraries like [Vega
Lite](https://vega.github.io/vega-lite/) (2D charts) and
[deck.gl](https://github.com/uber/deck.gl) (maps and 3D charts). And
finally we also provide a few chart types that are "native" to Streamlit,
like `st.line_chart` and `st.area_chart`.
## Simple chart elements
<TileContainer>
<RefCard href="/develop/api-reference/charts/st.area_chart">
<Image pure alt="screenshot" src="/images/api/area_chart.jpg" />
<h4>Simple area charts</h4>
Display an area chart.
```python
st.area_chart(my_data_frame)
```
</RefCard>
<RefCard href="/develop/api-reference/charts/st.bar_chart">
<Image pure alt="screenshot" src="/images/api/bar_chart.jpg" />
<h4>Simple bar charts</h4>
Display a bar chart.
```python
st.bar_chart(my_data_frame)
```
</RefCard>
<RefCard href="/develop/api-reference/charts/st.line_chart">
<Image pure alt="screenshot" src="/images/api/line_chart.jpg" />
<h4>Simple line charts</h4>
Display a line chart.
```python
st.line_chart(my_data_frame)
```
</RefCard>
<RefCard href="/develop/api-reference/charts/st.scatter_chart">
<Image pure alt="screenshot" src="/images/api/scatter_chart.svg" />
<h4>Simple scatter charts</h4>
Display a line chart.
```python
st.scatter_chart(my_data_frame)
```
</RefCard>
<RefCard href="/develop/api-reference/charts/st.map">
<Image pure alt="screenshot" src="/images/api/map.jpg" />
<h4>Scatterplots on maps</h4>
Display a map with points on it.
```python
st.map(my_data_frame)
```
</RefCard>
</TileContainer>
## Advanced chart elements
<TileContainer>
<RefCard href="/develop/api-reference/charts/st.pyplot">
<Image pure alt="screenshot" src="/images/api/pyplot.jpg" />
<h4>Matplotlib</h4>
Display a matplotlib.pyplot figure.
```python
st.pyplot(my_mpl_figure)
```
</RefCard>
<RefCard href="/develop/api-reference/charts/st.altair_chart">
<Image pure alt="screenshot" src="/images/api/vega_lite_chart.jpg" />
<h4>Altair</h4>
Display a chart using the Altair library.
```python
st.altair_chart(my_altair_chart)
```
</RefCard>
<RefCard href="/develop/api-reference/charts/st.vega_lite_chart">
<Image pure alt="screenshot" src="/images/api/vega_lite_chart.jpg" />
<h4>Vega-Lite</h4>
Display a chart using the Vega-Lite library.
```python
st.vega_lite_chart(my_vega_lite_chart)
```
</RefCard>
<RefCard href="/develop/api-reference/charts/st.plotly_chart">
<Image pure alt="screenshot" src="/images/api/plotly_chart.jpg" />
<h4>Plotly</h4>
Display an interactive Plotly chart.
```python
st.plotly_chart(my_plotly_chart)
```
</RefCard>
<RefCard href="/develop/api-reference/charts/st.bokeh_chart">
<Image pure alt="screenshot" src="/images/api/bokeh_chart.jpg" />
<h4>Bokeh</h4>
Display an interactive Bokeh chart.
```python
st.bokeh_chart(my_bokeh_chart)
```
</RefCard>
<RefCard href="/develop/api-reference/charts/st.pydeck_chart">
<Image pure alt="screenshot" src="/images/api/pydeck_chart.jpg" />
<h4>PyDeck</h4>
Display a chart using the PyDeck library.
```python
st.pydeck_chart(my_pydeck_chart)
```
</RefCard>
<RefCard href="/develop/api-reference/charts/st.graphviz_chart">
<Image pure alt="screenshot" src="/images/api/graphviz_chart.jpg" />
<h4>GraphViz</h4>
Display a graph using the dagre-d3 library.
```python
st.graphviz_chart(my_graphviz_spec)
```
</RefCard>
</TileContainer>
<ComponentSlider>
<ComponentCard href="https://github.com/tvst/plost">
<Image pure alt="screenshot" src="/images/api/components/plost.jpg" />
<h4>Plost</h4>
A deceptively simple plotting library for Streamlit. Created by [@tvst](https://github.com/tvst).
```python
import plost
plost.line_chart(my_dataframe, x='time', y='stock_value', color='stock_name',)
```
</ComponentCard>
<ComponentCard href="https://github.com/facebookresearch/hiplot">
<Image pure alt="screenshot" src="/images/api/components/hiplot.jpg" />
<h4>HiPlot</h4>
High dimensional Interactive Plotting. Created by [@facebookresearch](https://github.com/facebookresearch).
```python
data = [{'dropout':0.1, 'lr': 0.001, 'loss': 10.0, 'optimizer': 'SGD'}, {'dropout':0.15, 'lr': 0.01, 'loss': 3.5, 'optimizer': 'Adam'}, {'dropout':0.3, 'lr': 0.1, 'loss': 4.5, 'optimizer': 'Adam'}]
hip.Experiment.from_iterable(data).display()
```
</ComponentCard>
<ComponentCard href="https://github.com/andfanilo/streamlit-echarts">
<Image pure alt="screenshot" src="/images/api/components/echarts.jpg" />
<h4>ECharts</h4>
High dimensional Interactive Plotting. Created by [@andfanilo](https://github.com/andfanilo).
```python
from streamlit_echarts import st_echarts
st_echarts(options=options)
```
</ComponentCard>
<ComponentCard href="https://github.com/randyzwitch/streamlit-folium">
<Image pure alt="screenshot" src="/images/api/components/folium.jpg" />
<h4>Streamlit Folium</h4>
Streamlit Component for rendering Folium maps. Created by [@randyzwitch](https://github.com/randyzwitch).
```python
m = folium.Map(location=[39.949610, -75.150282], zoom_start=16)
st_data = st_folium(m, width=725)
```
</ComponentCard>
<ComponentCard href="https://github.com/explosion/spacy-streamlit">
<Image pure alt="screenshot" src="/images/api/components/spacy.jpg" />
<h4>Spacy-Streamlit</h4>
spaCy building blocks and visualizers for Streamlit apps. Created by [@explosion](https://github.com/explosion).
```python
models = ["en_core_web_sm", "en_core_web_md"]
spacy_streamlit.visualize(models, "Sundar Pichai is the CEO of Google.")
```
</ComponentCard>
<ComponentCard href="https://github.com/ChrisDelClea/streamlit-agraph">
<Image pure alt="screenshot" src="/images/api/components/agraph.jpg" />
<h4>Streamlit Agraph</h4>
A Streamlit Graph Vis, based on [react-grah-vis](https://github.com/crubier/react-graph-vis). Created by [@ChrisDelClea](https://github.com/ChrisDelClea).
```python
from streamlit_agraph import agraph, Node, Edge, Config
agraph(nodes=nodes, edges=edges, config=config)
```
</ComponentCard>
<ComponentCard href="https://github.com/andfanilo/streamlit-lottie">
<Image pure alt="screenshot" src="/images/api/components/lottie.jpg" />
<h4>Streamlit Lottie</h4>
Integrate [Lottie](https://lottiefiles.com/) animations inside your Streamlit app. Created by [@andfanilo](https://github.com/andfanilo).
```python
lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json")
st_lottie(lottie_hello, key="hello")
```
</ComponentCard>
<ComponentCard href="https://github.com/null-jones/streamlit-plotly-events">
<Image pure alt="screenshot" src="/images/api/components/plotly-events.jpg" />
<h4>Plotly Events</h4>
Make Plotly charts interactive!. Created by [@null-jones](https://github.com/null-jones/).
```python
fig = px.line(x=[1], y=[1])
selected_points = plotly_events(fig)
```
</ComponentCard>
<ComponentCard href="https://extras.streamlit.app/">
<Image pure alt="screenshot" src="/images/api/components/extras-chart-annotations.jpg" />
<h4>Streamlit Extras</h4>
A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/).
```python
chart += get_annotations_chart(annotations=[("Mar 01, 2008", "Pretty good day for GOOG"), ("Dec 01, 2007", "Something's going wrong for GOOG & AAPL"), ("Nov 01, 2008", "Market starts again thanks to..."), ("Dec 01, 2009", "Small crash for GOOG after..."),],)
st.altair_chart(chart, use_container_width=True)
```
</ComponentCard>
</ComponentSlider>
|