stocnet / manynet

Many Ways to Make, Manipulate, and Map Myriad Networks
https://stocnet.github.io/manynet/
Other
12 stars 0 forks source link

Make "star" layout the default for when plotting ego networks with `graphs()` #66

Closed henriquesposito closed 4 months ago

henriquesposito commented 8 months ago

Ideally the default layout for a netlist of ego networks should be concentric layouts with the ego appearing in the centre and nodes @dist1 arrayed around the next level and any nodes @dist2 at the next circle beyond that...

jhollway commented 8 months ago

How will it know that the list of networks is of ego networks?

jhollway commented 4 months ago

Suggestions for how to solve each of these two issues:

henriquesposito commented 4 months ago

This has been implemented, thank you for the suggestions, they were very helpful. graphs() now identifies ego networks automatically and uses the "star" layout (and centers plot on correct ego). See examples below:

# automatic
graphs(to_egos(ison_adolescents), waves = 1:8, node_size = 1)
# when "star" layout is declared uses `{igraph}` defaults, that is, centers on first node
graphs(to_egos(ison_adolescents), waves = 1:8, layout = "star", node_size = 1) 
# when ego network is not identified, defaults to stress layout
graphs(unname(to_egos(ison_adolescents)), waves = 1:8, node_size = 1)
graphs(to_egos(ison_adolescents), waves = 1:8, layout = "stress", node_size = 1)
jhollway commented 4 months ago

Thanks Henrique. What about other 'splits'?

graphs(to_subgraphs(ison_lotr, "Race"), waves = 1:4, node_size = 1)
Layouts were not standardised since not all nodes appear across waves.
Warning message:
In order_alphabetically(names(netlist)) == order_alphabetically(unique(unlist(unname(lapply(netlist,  :
  longer object length is not a multiple of shorter object length
jhollway commented 4 months ago

Also, it seems that if ego's network only contains one other node, ego is not centred within the plotting space? In my case, some of the distances to alters don't seem equal either.

Otherwise I really like how the naming is used.