Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force Directed Layout Restricted to 2D Plane #9

Open
fredhohman opened this issue Mar 3, 2017 · 3 comments
Open

Force Directed Layout Restricted to 2D Plane #9

fredhohman opened this issue Mar 3, 2017 · 3 comments

Comments

@fredhohman
Copy link

fredhohman commented Mar 3, 2017

Is there a way to run the force directed graph layout on a graph but restrict the layout to 2D, say in the x-y plane?

i.e. just the standard layout technique found in other graph plotting packages.

Thanks!

@patrickfuller
Copy link
Owner

From here, jgraph.generate has an is_3d parameter. If you set that to False, it should generate a 2D graph.

@fredhohman
Copy link
Author

Perfect, got it working. Is there any way to have this work with jgraph.draw() in order to preserve the animation of the nodes moving into a steady state (e.g. the optimize parameter)?

@patrickfuller
Copy link
Owner

Doing it client side (so you see the animations) would require stripping out a few lines from this javascript function. You might be able to overwrite from the notebook with something like:

from IPython.display import Javascript
Javascript('jgraph.optimize = function () { # new function here }')

Alternately, you could write your own 3d toggle option in the javascript file and then submit a PR with the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants