You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm new to the plot.ly lib but I already discovered an issue.
If there is a node with:
no links
only links with the value of zero
the manual positioning doesn't work anymore except if you delete the relating coordinates of this node and keep the node in the list (see third example).
Below you can find a short testing code with the generated output.
The text was updated successfully, but these errors were encountered:
rubenbfeld
changed the title
node positions do not work with link value 0 in Sankey
node positions do not work with link value zero in Sankey
Feb 4, 2020
Don't know if this helps you, but I maybe found a workaround for this, at least for my use case.
This is my first post on Github, so excuse any weird rambling or lack of structure.
My understanding is that when a value = 0, it shifts the relationship between source and target.
My value dictionary consists of dataframe rows since I retrieve it from a SQL database.
I built a simple function which just checks if the data in values is 0 or not.
def test(index: int, values: list): if values[index] == 0: return None else: return index
I do this because I build my value,source and target as lists first, then throw them as a dictionary in link.
When you throw None in source or target, it just eliminates that specific flow. So in my mind, you can never have a node with a flow of 0, because that's technically just an empty flow.
So, originally my source : source = [ 0,0 ,2,2 ,3,3 ,4,4 ,6,6,6 ]
So what I did was just replace all those numbers, since they are technically indexes for my dataframe. I implemented this into my source list. As a quick example my source then became: source = [test(0, value), test(0, value), test(2, value), test(2, value), test(3, value), test(3, value), test(4, value), test(4, value), test(6, value), test(6, value), test(6, value)]
This should not change the structure, in the end leaving your formatting as is.
Let me know if you have any questions or of this works for you or not.
For me it works by removing the sources with dead targets.
Hello,
I'm new to the plot.ly lib but I already discovered an issue.
If there is a node with:
the manual positioning doesn't work anymore except if you delete the relating coordinates of this node and keep the node in the list (see third example).
Below you can find a short testing code with the generated output.
working example
node with only one link with value of zero
kind of working again cause coordinates of C are deleted
The text was updated successfully, but these errors were encountered: