Reputation:
I have a network that I created by importing a gml file.
If I plot this network using plot
, nodes have the correct label (string).
If I try to do the same thing using ggnet2, the labels become numbers.
Why?
This is my code:
library(igraph)
library(poweRlaw)
library(sna)
library(ggplot2)
library(GGally)
library(ergm)
library(intergraph)
net <- read.graph("./network.gml", format = c("gml"))
plot(net) netb <- asNetwork(net) ggnet2(netb, size = "degree", label = TRUE)
Upvotes: 1
Views: 1345
Reputation: 1727
Without seeing your data, it's most likely that read.graph
is setting the vertex names to be numbers and that plot
is grabbing the names from a different variable. The ggnet2 documentation explains that the label
variable can be set to the name of the vertex attribute that you wish to use. Try changing label = TRUE
to label="<VertexName>"
where <VertexName>
is the name of the vertex in netb
that contains the labels.
Upvotes: 1