def draw_degree_rank_plot(orig_g, mG):
ori_degree_seq = sorted(nx.degree(orig_g).values(), reverse=True) # degree sequence
deg_seqs = []
for newg in mG:
deg_seqs.append(sorted(nx.degree(newg).values(), reverse=True)) # degree sequence
df = pd.DataFrame(deg_seqs)
plt.xscale('log')
plt.yscale('log')
plt.fill_between(df.columns, df.mean() - df.sem(), df.mean() + df.sem(), color='blue', alpha=0.2, label="se")
h, = plt.plot(df.mean(), color='blue', aa=True, linewidth=4, ls='--', label="H*")
orig, = plt.plot(ori_degree_seq, color='black', linewidth=4, ls='-', label="H")
plt.title('Degree Distribution')
plt.ylabel('Degree')
plt.ylabel('Ordered Vertices')
plt.tick_params(
axis='x', # changes apply to the x-axis
which='both', # both major and minor ticks are affected
bottom='off', # ticks along the bottom edge are off
top='off', # ticks along the top edge are off
labelbottom='off') # labels along the bottom edge are off
plt.legend([orig, h], ['$H$', 'HRG $H^*$'], loc=3)
# fig = plt.gcf()
# fig.set_size_inches(5, 4, forward=True)
plt.show()
评论列表
文章目录