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

Sigma and Gephi have inverse y axes #5

Open
computermacgyver opened this Issue Mar 9, 2013 · 7 comments

Comments

Projects
None yet
5 participants
@computermacgyver
Copy link

computermacgyver commented Mar 9, 2013

Invert the y-coordinates so that layout in browser matches Gephi (This is especially important for geographic layouts)

@jthrilly

This comment has been minimized.

Copy link
Member

jthrilly commented Mar 9, 2013

Just out of curiosity.....could this explain any issues with touch events? I could never get them to work properly.

@computermacgyver

This comment has been minimized.

Copy link

computermacgyver commented Mar 9, 2013

I don't know. I wouldn't have thought so because sigma is consistent
within itself. It's just that the origin is in a different location
which means the graph is rendered upside down as compared to how it is
rendered in Gephi. However, thinking about it more if the origin is in
the bottom-left (instead of the typically top-left) then depending how a
pan event was sent to Sigma it could result in the graph moving the
wrong way (i.e. up instead of down). It shouldn't cause issues with
other directors or with zoom, however, I would think.

@timdcrain

This comment has been minimized.

Copy link

timdcrain commented Mar 14, 2013

I changed this in Sigma here: 3d9e1faebdef4cd2816936d92173bf50c201d228

This puts the origin in the center, not the bottom left, but it does invert the y-axis so it should match Gephi. Also, this leaves the underlying coordinate system unchanged, so pan events should be preserved (although I have no idea if this is true).

@computermacgyver

This comment has been minimized.

Copy link

computermacgyver commented Mar 14, 2013

Thanks, Tim. This looks like a good solution. I'm linking to the pull request for my own reference:
jacomyal/sigma.js#77

@NoahGordon

This comment has been minimized.

Copy link

NoahGordon commented Aug 7, 2013

How do you invert the y-coordinates so the layout in the browser matches Gephi?

@computermacgyver

This comment has been minimized.

Copy link

computermacgyver commented Aug 7, 2013

@NoahGordon I was waiting on upstream, Sigma.js, and ideally wanted to see this fix there to avoid having different versions of sigma.js floating around. I consider this bug low priority as, in general, graph layout is invariant to the exact position of nodes (i.e., a flipped graph is isomorphically the same graph and the flip doesn't affect its presentation usually [geographic layouts being the one counter-example I've seen]).

Nonetheless, I may address this in an interm release while waiting on upstream. Probably the easiest fix is to alter the js/sigma/sigma.parseJson.js file to add the second line as follows:

var id=data.nodes[i].id;
data.nodes[i].y=-data.nodes[i].y;
@ahalterman

This comment has been minimized.

Copy link

ahalterman commented Nov 20, 2013

Thanks @computermacgyver ! I'm working with a geo layout and adding that line to sigma.parseJson.js solved the inversion problem right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment