plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
16.81k stars 1.85k forks source link

Align links of same label in Sankey diagrams #3568

Open harisbal opened 5 years ago

harisbal commented 5 years ago

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

antoinerg commented 5 years ago

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 :)

harisbal commented 5 years ago

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!

alexcjohnson commented 5 years ago

@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.

harisbal commented 5 years ago

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

harisbal commented 5 years ago

@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.

Kmysiak commented 2 years ago

@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.

gvwilson commented 2 months ago

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

joshhopkins commented 1 week ago

@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.