Skip to content

Instantly share code, notes, and snippets.

@Padhma
Created July 9, 2021 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Padhma/7b83d89ecdf5c3716f0a014adc84adda to your computer and use it in GitHub Desktop.
Save Padhma/7b83d89ecdf5c3716f0a014adc84adda to your computer and use it in GitHub Desktop.
# create a list of top 10 users with more repositories
users_with_more_repos = github_df.groupby('User_Name').size().nlargest(n=10).reset_index(name='Count')['User_Name'].to_list()
# create a dataframe using users_with_more_repos list
more_repos_users = github_df[github_df['User_Name'].isin(users_with_more_repos)][['Topic','User_Name','Star']]
# plot data
sns.countplot(data=more_repos_users,y='User_Name',palette = 'cool',order=more_repos_users['User_Name'].value_counts().index);
# set figure size and dpi
fig, ax = plt.subplots(figsize=(8,4), dpi=100)
# add colors to xticks, yticks and change labelsize
plt.rcParams['xtick.color']='#333F4B'
plt.rcParams['xtick.labelsize']=12
plt.rcParams['ytick.color']='#333F4B'
plt.rcParams['ytick.labelsize']=12
# remove border, grid and set x-limit
sns.despine(left=True, bottom=True)
ax.grid(False)
ax.set_facecolor('white')
ax.set_xlim(0,18)
# set x and y-axis labels and title
ax.set_xlabel('Count', fontsize=12, color = '#333F4B')
ax.set_ylabel('User Name', fontsize=12, color = '#333F4B')
fig.suptitle('Top 10 users with more repositories',fontsize=18, color = '#333F4B');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment