-
Notifications
You must be signed in to change notification settings - Fork 89
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
Adding crossing minimisation and straightness model #136
base: master
Are you sure you want to change the base?
Conversation
Now the `SankeyLayout` contains the node positions, which can be optimised and passed into the `to_widget` method. I think it makes sense to keep this separate from the `SankeyData`. Note FIXME comments for parts that are not fully implemented.
Edge weight should come from `SankeyLink.link_width`, not `SankeyLink.data["value"]`: while "value" is the default it doesn't have to be called that. Fix attribs default value factories for `SankeyNode` and `SankeyLink`. Add some xfail tests for diagram optimisation.
@stratus85 thanks for getting this started. I've tested and done some reorganisation to simplify the functions used to optimise the node order and node positions. Can you try the updated "test1" (now renamed to I've also added some unit tests in the file |
debugging purposes
floweaver/diagram_optimisation.py
Outdated
@@ -571,7 +571,7 @@ def optimise_node_positions(sankey_data, | |||
|
|||
model = straightness_model(sankey_data) | |||
# FIXME this needs to know what scale we want to use? | |||
ys = optimise_position_model(model, scale, wslb=minimum_gap) | |||
ys = optimise_position_model(model, scale, wslb=minimum_gap*scale) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stratus85 why does the minimum gap need to be scaled? I think it probably makes sense to have this defined in terms of pixels (i.e. the actual gap in the final Sankey diagram)?
@@ -12,7 +12,7 @@ | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": null, | |||
"execution_count": 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stratus85 not a big problem, but you can see that there are lots of changes in the notebook JSON file here which makes it hard to see the thing you actually changed. Please clear the notebook output and save before committing it to git.
1. Relative positioning of nodes in the layer 2. Used that to change positioning of nodes 3. Tried including extra punishment for not being completely straight (needs revision)
New global steel flows dataset, added dataset_manipulation.py and significantly changed diagram_optimisation.py
with more_testing folder