# Sankey Node Hover Issue

**URL:** <https://community.plotly.com/t/sankey-node-hover-issue/28324>\
**Category:** plotly.js\
**Created:** [September 6, 2019, 4:52pm UTC](https://community.plotly.com/t/sankey-node-hover-issue/28324 "2019-09-06T16:52:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryankinsey1](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/ryankinsey1/32/7537_2.png) [@ryankinsey1](https://community.plotly.com/u/ryankinsey1)\
**Post date:** [September 6, 2019, 4:52pm UTC](https://community.plotly.com/t/sankey-node-hover-issue/28324/1 "2019-09-06T16:52:41Z")

</div>

When hovering over a Sankey node, the highlighted links include more than just the links from the previous/next node. The incoming/outgoing value is correct, but for some reason when hovering a _random link_ is highlighted from the first node to the last node. Has anyone had a similar issue or know why this might be happening?

 ![captured%20(2)](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/e/e40672940894676b341f9cb5444b6c54a4a5e913.gif)

Below is a snippet of the data. I’ve checked the source/target/value for the _random link_ and it’s structured correctly. In fact, the _random link_ changes each time the graph is generated so I’m pretty certain that it’s not an issue with the links, targets, or labels in the data.  
 ![Sankey_Data](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/e/efa6f99acfaf18fdc1d1cd40e084aedcfd6bc49e.png)

Here is the code for the sankey graph:

data\_trace = dict(  
type=‘sankey’,  
domain=dict(  
x=[0, 1],  
y=[0, 1]  
),  
hoverlabel=dict(  
bgcolor=‘rgba(255, 255, 230, 1.0)’,  
align=‘auto’,  
bordercolor=’#000000’,  
namelength=-1,  
font=dict(  
family=‘Helvetica’,  
size=15,  
color=’#000000’  
)),  
orientation=“h”,  
valueformat=".0f",  
textfont=dict(  
family=“Arial Black”,  
size=15,  
color=‘black’  
),  
node=dict(  
pad=30,  
thickness=30,  
color=["#1F1B1B",  
“#CA0000”, “#FFFFF0”, “#002147”, “#e7f5fe”, “#FFFAFA”, “#660000”, “#ffdd1a”, “#156eb7”, “#6115b7”,  
“#CA0000”, “#FFFFF0”, “#002147”, “#e7f5fe”, “#FFFAFA”, “#660000”, “#ffdd1a”, “#156eb7”, “#6115b7”,  
“#CA0000”, “#FFFFF0”, “#002147”, “#e7f5fe”, “#FFFAFA”, “#660000”, “#ffdd1a”, “#156eb7”, “#6115b7”,  
“#CA0000”, “#FFFFF0”, “#002147”, “#e7f5fe”, “#FFFAFA”, “#660000”, “#ffdd1a”, “#156eb7”, “#6115b7”,  
“#CA0000”, “#FFFFF0”, “#002147”, “#e7f5fe”, “#FFFAFA”, “#660000”, “#ffdd1a”, “#156eb7”, “#6115b7”,  
“#CA0000”, “#FFFFF0”, “#002147”, “#e7f5fe”, “#FFFAFA”, “#660000”, “#ffdd1a”, “#156eb7”, “#6115b7”,  
“#CA0000”, “#FFFFF0”, “#002147”, “#e7f5fe”, “#FFFAFA”, “#660000”, “#ffdd1a”, “#156eb7”, “#6115b7”,  
“#CA0000”, “#FFFFF0”, “#002147”, “#e7f5fe”, “#FFFAFA”, “#660000”, “#ffdd1a”, “#156eb7”, “#6115b7”],  
line=dict(  
# color = “black”,  
width=0.5  
),  
label=[“High School or GED”,  
“Enlisted”, “School”, “Work”, “Work and School”, “Work and Reserves”, “School and Reserves”,  
“Retirement”, “ROTC or Mil. Academy”, “Transferred Schools”,  
“Enlisted”, “School”, “Work”, “Work and School”, “Work and Reserves”, “School and Reserves”,  
“Retirement”, “ROTC or Mil. Academy”, “Transferred Schools”,  
“Enlisted”, “School”, “Work”, “Work and School”, “Work and Reserves”, “School and Reserves”,  
“Retirement”, “ROTC or Mil. Academy”, “Transferred Schools”,  
“Enlisted”, “School”, “Work”, “Work and School”, “Work and Reserves”, “School and Reserves”,  
“Retirement”, “ROTC or Mil. Academy”, “Transferred Schools”,  
“Enlisted”, “School”, “Work”, “Work and School”, “Work and Reserves”, “School and Reserves”,  
“Retirement”, “ROTC or Mil. Academy”, “Transferred Schools”,  
“Enlisted”, “School”, “Work”, “Work and School”, “Work and Reserves”, “School and Reserves”,  
“Retirement”, “ROTC or Mil. Academy”, “Transferred Schools”,  
“Enlisted”, “School”, “Work”, “Work and School”, “Work and Reserves”, “School and Reserves”,  
“Retirement”, “ROTC or Mil. Academy”, “Transferred Schools”,  
“Enlisted”, “School”, “Work”, “Work and School”, “Work and Reserves”, “School and Reserves”,  
“Retirement”, “ROTC or Mil. Academy”, “Transferred Schools”],  
),  
link=dict(  
source=dff[‘Source’].dropna(axis=0, how=‘any’),  
target=dff[‘Target’].dropna(axis=0, how=‘any’),  
value=dff[‘Value’].dropna(axis=0, how=‘any’),  
color=“rgba(140, 140, 140, .025)”,  
label=dff[‘Label’].dropna(axis=0, how=‘any’),  
)  
),

---

<div class="post-metadata">

**Author:** ![dominickpannone](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@dominickpannone](https://community.plotly.com/u/dominickpannone)\
**Post date:** [September 25, 2019, 8:11pm UTC](https://community.plotly.com/t/sankey-node-hover-issue/28324/2 "2019-09-25T20:11:33Z")

</div>

Check if your links have the same “label”, this is feature is useful for me to show like or similar links.

---

<div class="post-metadata">

**Author:** ![ryankinsey1](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/ryankinsey1/32/7537_2.png) [@ryankinsey1](https://community.plotly.com/u/ryankinsey1)\
**Post date:** [September 26, 2019, 2:42pm UTC](https://community.plotly.com/t/sankey-node-hover-issue/28324/3 "2019-09-26T14:42:12Z")

</div>

Yes, the links have identical labels when appropriate. I am using the label as a mechanism to connect links to one another which allows for ‘mapping the route’ an individual takes.

This function is working appropriately. When hovering over any link, it highlights the ‘route’ a person took from node [0] to whatever their final node may be (node [-1], if you will).

However, my issue is that when hovering over any given node there is a random set of links (connected using identical labels) that gets highlighted from beginning to end. As I understand it, highlighting a node should _only_ highlight the links from the previous/next nodes; _not_ a set of links from beginning to end.

I’ve looked through the data (source, targets, values, labels) multiple times and everything is structured correctly, so I’m wondering if it’s a bug.
