Turn vertical bar chart to horizontal?

Hey @hahahazel,

So st.bar_chart is just a wrapper and is just meant as an easy way to create an Altair chart.

See docs.streamlit.io/library/api-reference/charts/st.bar_chart#stbar_chart

If you want a graph horizontal, you will need to create that chart yourself in Altair (or another python plotting library) rotate it with that library and then pass it to the appropriate streamlit function.

For Altair that’s: st.altair_chart

Docs for that here: docs.streamlit.io/library/api-reference/charts/st.altair_chart#staltair_chart

Actually for Altair, it looks like they just have a horizontal bar chart function:
https://altair-viz.github.io/gallery/bar_chart_horizontal.html

Happy Streamlit-ing
Marisa

1 Like