I am very new to igraph, and have been plotting out a project of mine. In my python code I used the:
to identify the groups.
The problem is the coloring of this VertexCluster. When using the VertexCluster as “mark_groups” for the visual style, the groups are grey. Despite using “mark_col”, it does not change.
How do I change the colors for mark_groups when using a VertexClustering.FromAttribute?
This snippet seems to work for me (i.e. the groups are colored according to the clustering):
import igraph as ig
import matplotlib.pyplot as plt
g = ig.Graph(edges=[(0, 1), (1, 2), (3, 4), (4, 5)])
g.vs["cluster"] = [0, 0, 0, 1, 1, 1]
communities = ig.VertexClustering.FromAttribute(g, "cluster")
fig, ax = plt.subplots()
I’m getting two groups, one red and one green, and the vertices are colored accordingly. If this is not what you see in your code, please post a short, small, reproducible example that illustrates the problem.