Tables as node labels in ipycytoscape

219 Views Asked by At

I am using ipycytoscape in Python to make a version of Tensorflow's plot_model function for PyTorch. I would like to be able to draw, in Cytoscape, a plot like the attached picture.

enter image description here

If I just try to format strings in the node label with \n end-line characters, Cytoscape removes all the white space characters so I don't get that kind of basic formatting. I am thinking to use either HTML or format a JPEG image for each label using another plotting package and then insert that image as the node label.

After many hours of Google search I have been unable to find a clear example which formats anything like the above nodes.

Please help me figure out how to make node labels of the above style in either ipycytoscape or Dash Plotly Cytoscape.

1

There are 1 best solutions below

1
maxkfranz On

Use SVG background images to render arbitrary content in nodes. See the SBGN stylesheet [1] for examples, e.g. the open/closed glyphs in the demo [2]. If you make tables with SVG, you may make that an extension similar to the SBGN one.

[1] https://github.com/PathwayCommons/cytoscape-sbgn-stylesheet

[2] https://pathwaycommons.github.io/cytoscape-sbgn-stylesheet/