3

I'm trying to make and plot an ego network of a given vertex in a larger network. I get my network from a csv file containing a weighted edge list:

art<-read.csv(file.choose("art.csv"))
g_art<-graph.data.frame(art)

Then, I use the function make_ego_graph as follows:

g_ego_art<-make_ego_graph(g_art, order=2, nodes = "PLAZA")

Then I try to plot the vertex PLAZA's ego netrwork and I get this error:

plot(g_ego_art)
Error in xy.coords(x, y, xlabel, ylabel, log) : 
  'x' is a list, but does not have components 'x' and 'y'

Any help, please? Thanks!

SabDeM
  • 7,050
  • 2
  • 25
  • 38
  • 3
    Welcome to SO. Help us to help you by providing a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and do read also [these](http://stackoverflow.com/help/how-to-ask) guidelines about how to ask a good question here. The more clear and easy to understand the question is the more you will receive help. – SabDeM Aug 08 '15 at 23:39
  • 1
    `make_ego_graph` returns a list of graphs, not a graph. – Gabor Csardi Aug 09 '15 at 19:14
  • so, I guess the first element in the list is my ego graph – Pablo Galaso Aug 10 '15 at 20:33

1 Answers1

3

make_ego_graph will return a list of ego network... if u want to see the first one, simply plot(g_ego_art[[1]])

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109
john zhang
  • 41
  • 2
  • @Petter Friberg, Thanks for the comment, How can I show all list nodes in one graph? Thanks! – Alex Feb 24 '21 at 19:37