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?