How to resizing my graph?

st.subheader('범죄별 ν˜„ν™©')
whole_values = my_pop.groupby('Offences')[['Total']].sum()
bar_width = 0.6
bar_color = 'orange'

fig, ax = plt.subplots()
ax.bar(whole_values.index, whole_values['Total'], width=bar_width, color=bar_color)
ax.set_xlabel('범죄 μ’…λ₯˜')
ax.set_ylabel('λ²”μ£„μž 수(λ‹¨μœ„: λͺ…)')
ax.set_title('범죄별 λ²”μ£„μž 수')
ax.yaxis.set_major_formatter(ticker.StrMethodFormatter('{x:,.0f}'))
ax.set_xticklabels(whole_values.index, rotation=90, ha='right')

st.pyplot(fig)

I used an above code and it shows giant grph on the web… How to make the graph smaller on the web?

How about updating your figure layout as follows?

fig.update_layout(width=800, height=400)

st.pyplot(fig)

Let me know if that works!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.