'R igraph color vertices

I'm trying to make a connectogram using code that's worked for me before but for some reason I'm having issue with the color of the vertices

plot(net, edge.width=sqrt(links$weight), edge.arrow.size=0, 
     edge.lty=1, arrow.mode=0, vertex.size=10,
     vertex.label=nodes$Name, vertex.label.dist=1.3, 
     vertex.label.cex=1.2, vertex.label.degree=-pi/4, 
     vertex.color=nodes$Team, layout=layout_in_circle)

The error I'm getting is Error in symbols(x = coords[, 1], y = coords[, 2], bg = vertex.color, : invalid color name 'Biomarkers'

Biomarkers is one of the variables in the Teams column. I'm attaching figures that are generated when I take out the vertex.color piece, so I know the rest of it works, and when I get this error (ignore the label overlap, I'll fiddle with that later)

Connectogram2

Connectogram



Solution 1:[1]

This is the error message that you would get if nodes$Team is a character variable, i.e. strings. You can get around this by making Team into a factor variable.

nodes$Team=as.factor(nodes$Team)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 G5W