Layout code

18 views
Skip to first unread message

Russ

unread,
Nov 30, 2009, 12:50:27 PM11/30/09
to cytoscape-discuss
Howdy,
Just a trivial query, really. When I set up new networks in cytoscape
(programmatically) all the nodes get added on top of each other. I
can't find the code that allows me to set a network layout, for
example I'd like find the code that imposes the GridLayout to a
network.

Kind regards
Russ
Uni. Liverpool

Scooter Morris

unread,
Nov 30, 2009, 1:13:39 PM11/30/09
to cytoscap...@googlegroups.com
Hi Russ,
If you want to look at the GridLayout code, it's in
src/cytoscape/layout/algorithms/GridNodeLayout.java. However, I think
what you really want to do is to just call that from your plugin. To do
that, you would do the following:

CyLayoutAlgorithm gridLayout = CyLayouts.getLayout("grid");
gridLayout.doLayout(myNetworkView);

Similarly, you can use any of the other Cytoscape layouts in the same
way. For example:

CyLayoutAlgorithm forceLayout = CyLayouts.getLayout("force-directed");
forceLayout.doLayout(myNetworkView);

-- scooter
> --
>
> You received this message because you are subscribed to the Google Groups "cytoscape-discuss" group.
> To post to this group, send email to cytoscap...@googlegroups.com.
> To unsubscribe from this group, send email to cytoscape-disc...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cytoscape-discuss?hl=en.
>
>
>

scooter.vcf

Russ

unread,
Nov 30, 2009, 1:22:04 PM11/30/09
to cytoscape-discuss
Cheers Scooter, you knew what I was trying to ask better than I did.
R
Reply all
Reply to author
Forward
0 new messages