Skip to content

Instantly share code, notes, and snippets.

@tanpengshi
Created September 7, 2020 16:00
Show Gist options
  • Save tanpengshi/f246c8db672bd1be458d0e933585cc79 to your computer and use it in GitHub Desktop.
Save tanpengshi/f246c8db672bd1be458d0e933585cc79 to your computer and use it in GitHub Desktop.
Creating Barplot
plt.figure(figsize=[8,5])
ax = sns.barplot(data=group_station.head(10).reset_index(),x='ENTRY_EXIT',y='STATION',palette='rainbow')
plt.xlabel('Total Traffic',weight='bold',fontsize=15)
plt.ylabel('Top 10 Stations',weight='bold',fontsize=15)
plt.xticks(range(0,400001,50000),[str(int(i/1000))+'k' for i in range(0,400001,50000)])
plt.title('Busiest MTA Stations from 22/8 to 28/8', weight='bold',fontsize='15')
for p in ax.patches:
ax.annotate(str(int(p.get_width()/1000))+'k', (p.get_width(), p.get_y()+0.5))
sns.despine()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment