Add a documented case to know how to use extraneous layout
And maybe refactor layout to accept multiple formats.
Hi @Yomguithereal I'm currently trying to use a pre-computed layout positions in ipysigma, but the nodes are not showing at all. What is the format that the layout mapping should have?
The default pos dicc from networkx has the following format:
{node: (x, y) }, where (x, y) is a tuple.
I tried to convert it to {node: {x, y} } as specified in the documentation, and that is not working either.
Ok, reading the code I found the way, in case it can be useful for someone:
The actual format of the layout mapping should be:
layout = {
"node1": {"x": 0.5, "y": 0.5},
"node2": {"x": 1.2, "y": 2.3},
# ...
}
So to convert from a networkx positions dicc to this format you only need to do:
ipysigma_layout = {node: {"x": pos[0], "y": pos[1]} for node, pos in positions.items()}