vtraag / leidenalg

Implementation of the Leiden algorithm for various quality functions to be used with igraph in Python.
GNU General Public License v3.0
575 stars 77 forks source link

How to visualize also the labels of my nodes? #86

Closed Angela446-lgtm closed 2 years ago

Angela446-lgtm commented 2 years ago

After running partition = la.find_partition(g, la.CPMVertexPartition,resolution_parameter = 0.05) ig.plot(partition) I observed about 21 clusters of my dataset. Do you know if I could visualize also the labels of my nodes?

vtraag commented 2 years ago

Please note that this is the issue tracker of the leidenalg package, not of python-igraph. The issue tracker for python-igraph can be found at https://github.com/igraph/python-igraph, but it is not meant for support questions. The best thing is to post your question on the igraph forum.

Having said that, the solution is easy, you need to specify what you would like to use as labels. For example, if you have a vertex attribute called label, you can plot it using

ig.plot(partition, vertex_label=g.vs['label'])

Please see more details in the python-igraph reference manual on plotting.

If you have additional questions, probably best to continue the discussion in the igraph forum.