我正在关系图上执行群集,目前正在使用networkx
来查看结果:
G = nx.from_numpy_matrix(X)
layout = nx.fruchterman_reingold_layout(G)
nx.draw_networkx(G, pos=layout, with_labels=True, node_color=predict, cmap=plt.cm.coolwarm, vmin=0, vmax=1)
是否可以获得彩条?只需使用plt.colorbar()
就会出错:
RuntimeError: No mappable was found to use for colorbar creation. First define a mappable such as an image (with imshow) or a contour set (with contourf).
documentation中没有任何选项。 我也愿意使用另一个包进行可视化,只要它与Python 3兼容。