[Java] Change certain node colors and shapes

17 views
Skip to first unread message

M P

unread,
Aug 29, 2018, 8:14:27 PM8/29/18
to cytoscape-helpdesk
Hello, I have a plugin that generates networks in cytoscape. In order to view properly I need to assign different colors and shapes to some nodes.

I see there's a visual style program in the cytoscape java example but it's poorly documented and only adds the style to the list of styles.

How can I use the Java api to modify the node's visual properties? I am creating each CyNode individually but it seems to be a container class for the table data and separate from the class responsible for visual representation.

Scooter Morris

unread,
Aug 30, 2018, 11:06:20 AM8/30/18
to cytoscape-helpdesk
What you are looking for is the view model: org.cytoscape.view.model  In Cytoscape the view (how an object looks) is kept separate from the model (what an object is).  So, after you create your CyNode, you need to get the View<CyNode> for it (get that from the CyNetworkView of the network you are adding the node to).  Then, you can set the various visual properties.  Note that a list of visual properties is available in org.cytoscape.view.presentation.property.BasicVisualLexicon  This is all discussed pretty fully in the app ladder documentation: https://github.com/cytoscape/cytoscape/wiki/Intro-to-App-Dev

-- scooter
Reply all
Reply to author
Forward
0 new messages