How to create a horizontal bar chart with streamlit?

Hello and thanks for this amazing package!

I am trying to create a simple chart that shows bars horizontally (the data is generated within the app). Something like this (in R)

library(tidyverse)
df <- tibble(type = c('john', 'mark', 'anthony','susan'),
             value = c(10,14,34,12))
df %>% 
  ggplot(aes(x = value, y = type)) + 
  geom_col()

Is this something that can be done with streamlit?

Thanks!

Hi @datawhiz ,

You can use plotly to do that

import streamlit as st
import plotly.express as px 
df=px.data.tips()
fig=px.bar(df,x='total_bill',y='day', orientation='h')
st.write(fig)

Thanks,
Akshansh

2 Likes