ulfaslak / network_styling_with_d3

(1) Input a network. (2) Style it. (3) Download the result.
MIT License
28 stars 7 forks source link

Coordinate flip #16

Closed benmaier closed 5 years ago

benmaier commented 5 years ago

When exporting from the visualization, the y-positions are flipped, such that

newy = height - y

This is done so we can have a coordinate system which looks like this

y
^
|
|
|-----------> x

In the js-vis, however, we have coordinate system which looks like this

|-----------> x
|
|
|
v
y

We have to keep that in mind, when positions written to a graph object (to node attributes 'x' and 'y') and then passed to the visualizations. Maybe we should just flip them back when the graph is loaded in js.

benmaier commented 5 years ago

Also, the zoom value has to be regarded when loading networks with pre-given coordinates. Maybe first load the zoomscaler, then load x and y values but immediately convert them using the inverse function of the zoomscaler

ulfaslak commented 5 years ago

Finally addressed this in latest commit (8ed465120f465b91b7bb7c6256992ecd0635c3b3). Now, data is coming out of the visualization like:

-----------> x

v y

The point is that when inputting the network_properties to visualize again (enabled in recent commit on netwulf), we don't have to do any coordinate flipping.

Simultaneously, I flipped the coordinate plotting in netwulf.tools.draw_netwulf.

benmaier commented 5 years ago

okay, cool!