plotly supports bars with rounded corners.
However, it does not work with st.plotly_chart
Here is a simple code to see the issue:
import streamlit as st
import plotly.io as pio
import plotly.graph_objects as go
from plotly import data
from plotly.subplots import make_subplots
def create_figure():
df = data.medals_wide()
fig = make_subplots(rows=1, cols=3, shared_yaxes=True)
fig.add_trace(go.Bar(x=df.nation, y=df.gold, name="Gold", marker=dict(cornerradius=10, color='green' )), 1, 1)
fig.add_trace(go.Bar(x=df.nation, y=df.silver, name="Silver", marker=dict(cornerradius=10, color='silver')), 1, 2)
fig.add_trace(go.Bar(x=df.nation, y=df.bronze, name="Bronze", marker=dict(cornerradius=10, color='red' )), 1, 3)
return fig
def main():
st.title("Round Corners in Bar Charts")
fig = create_figure()
st.write('THIS DOES NOT WORK')
st.plotly_chart(fig) #-- THIS DOES NOT WORK
#-- THIS WORKS
st.write('THIS WORKS')
html_string = pio.to_html(fig)
st.components.v1.html(html_string, height=600)
if __name__ == "__main__":
main()
Any ideas how to make this work?
Thanks