python使用使用对数坐标系 fig, ax = plt.subplots() ax.set_xscale(“log“) ax.set_yscale(“log“)

python使用使用对数坐标系

newX = []
newY = []
for i in range(len(x)):
    if y[i] != 0 :
        newX.append(x[i])
        newY.append(y[i])

fig, ax = plt.subplots()
ax.plot(newX,newY, 'ro-')
ax.set_xscale("log")
ax.set_yscale("log")

ax.set_xlabel('$k$', fontsize='large')
ax.set_ylabel('$p_k$', fontsize='large')
ax.legend(loc="best")
ax.set_title("degree distribution")
fig.show()
posted @ 2022-05-19 10:59  bH1pJ  阅读(118)  评论(0编辑  收藏  举报