Skip to content

Instantly share code, notes, and snippets.

@davisvictorns
Created September 15, 2021 02:14
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 davisvictorns/45bb3d73e71ef10a12b40365b0d90d07 to your computer and use it in GitHub Desktop.
Save davisvictorns/45bb3d73e71ef10a12b40365b0d90d07 to your computer and use it in GitHub Desktop.
plt.style.use("default")
# degree sequence
degree_sequence = sorted([d for n, d in G.degree()], reverse=True)
fig, ax = plt.subplots(1,2,figsize=(8,4))
# all_data has information about degree_sequence and the width of each bin
ax[0].hist(degree_sequence)
ax[1].hist(degree_sequence,bins=[x for x in range(50)])
ax[0].set_title("Degree Histogram")
ax[0].set_ylabel("Count")
ax[0].set_xlabel("Degree")
ax[0].set_ylim(0, max(degree_sequence))
ax[1].set_title("Degree Histogram - Zoom")
ax[1].set_ylabel("Count")
ax[1].set_xlabel("Degree")
ax[1].set_xlim(0, 50)
ax[1].set_ylim(0,100)
plt.tight_layout()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment