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()