1

I only want to show labels for the vertices that have a degree greater than 50. I've tried the following code :

plot(g, vertex.label=(V(g)$id[which(degree > 50)]))

But rather than only labeling the desired vertices, it seems to relabel all vertices using only the labels for those with a degree greater than 50.

How can I display a plot that only labels the desired vertices? Or is there a way to hide the undesired labels?

zx8754
  • 52,746
  • 12
  • 114
  • 209
user4100980
  • 127
  • 1
  • 1
  • 13

1 Answers1

0

Problem is that the length of the vertex.label vector needs to equal the number of vertices. Perhaps something like

plot(g, vertex.label=ifelse(degree(g) > 50, V(g)$id, NA) )
WaltS
  • 5,410
  • 2
  • 18
  • 24