0

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.

Lars Ericson
  • 1,952
  • 4
  • 32
  • 45

1 Answers1

1

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/

maxkfranz
  • 11,896
  • 1
  • 27
  • 36
  • Please show how to, in a Jupyter notebook using Python, generate the diagram shown in the SBGN stylesheet demo. I'm asking because I don't know JS at all, I only know Python, and I'm trying to draw exactly the SBGN kind of diagram, but in Python. – Lars Ericson Jun 08 '22 at 20:50