Can't find an error

offs_count = my_crs.groupby('Year')['Use&Possession', 'Trafficking', 'Others'].sum()
offs_count.columns = ['Use&Possession', 'Trafficking', 'Others']
    
fig, ax = plt.subplots(figsize=(8, 6))

bar_width = 0.35
offence_indices = np.arange(len(offs_count))

ax.bar(offence_indices, offs_count['Use&Possession'], width=bar_width, align='center', color='green', label='μ‚¬μš©/μ†Œμ§€')
ax.bar(offence_indices + bar_width, offs_count['Trafficking'], width=bar_width, align='center', color='pink', label='밀맀')
ax.bar(offence_indices + bar_width, offs_count['Others'], width=bar_width, align='center', color='yellow', label='κ·Έ μ™Έ')

ax.set_xlabel('연도')
ax.set_ylabel('건 수')
ax.set_title('범죄별 연도별 건 수')
ax.set_xticks(offence_indices + bar_width / 2)
ax.set_xticklabels(offs_count.index, rotation=90)
ax.yaxis.set_major_formatter(ticker.StrMethodFormatter('{x:,.0f}'))
    
ax.legend()
plt.tight_layout()

I used an above code to draw a graph but it doesn’t show up on the page.
Is there any error?

Hey @Jisu_Lee,

Thanks for sharing your question! Unfortunately, that code snippet isn’t runnable as-is, so we won’t be able to reproduce the error – can you please update your post so we can help you find a solution?

Probably just missing a line at the end passing the figure to streamlit. Check the example at st.pyplot - Streamlit Docs.

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