Re: [cytoscape-helpdesk] explicitly set coordinates for nodes programmatically

31 views
Skip to first unread message

Scooter Morris

unread,
Sep 13, 2012, 12:53:36 PM9/13/12
to cytoscape...@googlegroups.com, Michael Zimmermann
Hi Michael,
    Actually, in Cytoscape 2.x this is pretty easy.   I'm going to assume that you're updating the position of a node in the current network.  If so, here is what you would do:

    public void updateNode(CyNode node, double x, double y) {
        CyNetworkView networkView = Cytoscape.getCurrentNetworkView();
        NodeView nv = networkView.getNodeView(node);
        nv.setXPosition(x);
        nv.setYPosition(y);
    }

Hope this helps!

-- scooter


On 09/12/2012 09:18 AM, Michael Zimmermann wrote:
I am new to cytoscape but want to be able to explicitly set node coordiantes. In the API documentation I have seen the CyNodeView method getXPosition() at This Location,and the corresponding set method for x and y.
 
I imagine these could be used for what I want, but am new enough to Java and the Cytoscape API that I don't understant how to invoke these methods. I don't see an example in the developer's Cookbook either. Could a simple example of their use be provided?
 
Thank you very much.
--
You received this message because you are subscribed to the Google Groups "cytoscape-helpdesk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cytoscape-helpdesk/-/gVSEGhTFtU0J.
To post to this group, send email to cytoscape...@googlegroups.com.
To unsubscribe from this group, send email to cytoscape-helpd...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cytoscape-helpdesk?hl=en.

王磊

unread,
Oct 15, 2012, 9:44:04 PM10/15/12
to cytoscape...@googlegroups.com
To unsubscribe from this group, send email to cytoscape-helpdesk+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages