cytoscape / ipycytoscape

A Cytoscape Jupyter widget
https://ipycytoscape.readthedocs.io/en/master/
BSD 3-Clause "New" or "Revised" License
261 stars 62 forks source link

Retrieve nodes positions #333

Open fpom opened 2 years ago

fpom commented 2 years ago

How can I retrieve from Python the positions of the nodes in a graph?

When a layout is applied, the field position in .graph.nodes objects is not updated. So far, the only way I've found is to bind a mouseover event on nodes and get the positions from the events, but this is not convenient as it requires specific actions from the user.

TermeHansen commented 1 year ago

I would really like the option to save a layout of the graph after one has re-arranged it to a specific liking.

Is this really not possible?

Even if we get the positions updated from python side, I guess next problem is to set them https://github.com/cytoscape/ipycytoscape/issues/254

fpom commented 1 year ago

I answered #254: I have no problem moving nodes from Python, it requires assigning them positions and then calling the relayout method.

TermeHansen commented 1 year ago

Nice, but still no way to get node positions without mouse over user interaction?

fpom commented 1 year ago

Indeed, I'm still unable to get the nodes' positions, only to set them. So frustrating...