How to improve unused space in cytoscape-tidytree?
01:54 28 Nov 2025

Nodes with move option should be re-positioned.




    
    
    
    
    


    

Result is almost good, but node with label 7 is too far from left part. If you comment assemble function call in tree.ready you will understand WHY.

enter image description here

I cannot understand how is transform working. It is working, if you play with code you will see that all the "moved" nodes are placed in (0, 0), but node 7 position was calculated somehow counting on their actual precalculated positions and too far away too.

I can uncomment line tree.elements('[!move]').layout(layoutOptions).run(); in assemble function body - it looks like remove-restore nodes in tree - but in that case node with label 8 will be placed stricly on top of node 7, it is not so bad and it released in current project, but a little bit awkward. It looks like 7 has only one child and users can be confused.

enter image description here

I do want to combine all the good things (nodes placed as near as possible and node 8 in right-top direction of node 7) and remove all the bad things. Any ideas? Dirty hack of cytoscape-tidytree is more than acceptable.

layout cytoscape.js