I am performing clustering on relational graphs, and am currently using networkx
to visualize the result:
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)
Is it possible to get a colorbar? Simply using plt.colorbar()
gives the error:
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).
And there aren't any options in the documentation. I am also open to use another package for visualization as long as it is compatible with Python 3.