plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

Align links of same label in Sankey diagrams

Open harisbal opened this issue 6 years ago • 8 comments

Hello, sometimes links with the same label (i.e. type) may stretch across multiple levels of a sankey diagram. For instance in the following picture the links in red have the same label: inkedsankey-align_li I don't believe that there is any option at the moment to align these links so that they become continuous right?

Cheers

harisbal avatar Feb 22 '19 16:02 harisbal

Hello @harisbal and thank you for your interest in plotly.js!

Unfortunately, aligning links so they become continuous is not supported right now. To be honest with you, I won't have time to implement this in the very near future because there are other very important features that are much easier to implement.

To realize the feature you're asking, we would have to break links into smaller ones. For example, if a node only has two outgoing links, a given link can only be at the top or the bottom which may not produce a continuous alignment. To position it anywhere in the middle, we would have to split the other link into two to make a sandwich. This is not a feature/scenario that was considered when designing the Sankey layout generators.

I agree this feature would be useful however and I will keep it in mind when improving our layout generator :)

antoinerg avatar Feb 22 '19 17:02 antoinerg

Hi @antoinerg and thank you for the quick reply. I understand the implications, I just wanted to suggest it as a possible future feature. Cheers!

harisbal avatar Feb 22 '19 17:02 harisbal

@harisbal Have you seen the parcats trace type? https://plot.ly/python/parallel-categories-diagram/ It's a fairly new one https://github.com/plotly/plotly.js/pull/2963 that's in some ways a combination of parcoords and sankey, and does preserve alignment all the way across.

alexcjohnson avatar Feb 22 '19 17:02 alexcjohnson

@alexcjohnson this indeed seems very promising and probably is very similar to what I'm looking for. Thanks for the suggestion!

harisbal avatar Feb 22 '19 17:02 harisbal

@harisbal Have you seen the parcats trace type? https://plot.ly/python/parallel-categories-diagram/ It's a fairly new one #2963 that's in some ways a combination of parcoords and sankey, and does preserve alignment all the way across.

Hi @alexcjohnson Parallel categories are indeed very useful but have a "limitation" that all paths have to stretch from beginning to end. I explain. In the following picture screenshot_1 the nodes without titles should be deleted. Do you think that there is any solution to that. I was thinking to create a patch that deletes the non-required links although it would be a very "dirty"approach.

harisbal avatar Feb 27 '19 10:02 harisbal

@harisbal Have you seen the parcats trace type? https://plot.ly/python/parallel-categories-diagram/ It's a fairly new one #2963 that's in some ways a combination of parcoords and sankey, and does preserve alignment all the way across.

Hi @alexcjohnson Parallel categories are indeed very useful but have a "limitation" that all paths have to stretch from beginning to end. I explain. In the following picture screenshot_1 the nodes without titles should be deleted. Do you think that there is any solution to that. I was thinking to create a patch that deletes the non-required links although it would be a very "dirty"approach.

I'm assuming that the links going into 2 and 3 are NULLS in the data. I wonder if there is a way to "hide" these links and nodes using color.

Kmysiak avatar Dec 14 '21 19:12 Kmysiak

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

gvwilson avatar Jun 11 '24 17:06 gvwilson

@antoinerg is this feature now available? If not, I suggest this issue be reopened as there is some useful context here. @alexcjohnson parallel categories do not allow cycles, so unfortunately doesn't solve this issue.

joshhopkins avatar Aug 15 '24 04:08 joshhopkins