# Sankey diagram : How to hide hovering value on link?

**URL:** <https://community.plotly.com/t/sankey-diagram-how-to-hide-hovering-value-on-link/43327>\
**Category:** 📊 Plotly Python\
**Created:** [August 3, 2020, 1:52pm UTC](https://community.plotly.com/t/sankey-diagram-how-to-hide-hovering-value-on-link/43327 "2020-08-03T13:52:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucaseo1991](https://avatars.discourse-cdn.com/v4/letter/l/35a633/32.png) [@lucaseo1991](https://community.plotly.com/u/lucaseo1991)\
**Post date:** [August 3, 2020, 1:52pm UTC](https://community.plotly.com/t/sankey-diagram-how-to-hide-hovering-value-on-link/43327/1 "2020-08-03T13:52:34Z")

</div>

Hi,

I’m trying out Sankey diagram for the first time ! And I’m loving it so far.

However, based on the example code, I was wondering if there is any way to hide the `value` hovering on the link. (red square in the image attached below)

```auto
import plotly.graph_objects as go

fig = go.Figure(data=[go.Sankey(
    node = dict(
      pad = 15,
      thickness = 20,
      line = dict(color = "black", width = 0.5),
      label = ["A1", "A2", "B1", "B2", "C1", "C2"],
      color = "blue"
    ),
    link = dict(
      source = [0, 1, 0, 2, 3, 3], # indices correspond to labels, eg A1, A2, A2, B1, ...
      target = [2, 3, 3, 4, 4, 5],
      value = [8, 4, 2, 8, 4, 2]
  ))])

fig.update_layout(title_text="Basic Sankey Diagram", font_size=10)
fig.show()

```

 ![Screen Shot 2020-08-03 at 10.48.16 PM](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/9/9dd0286dcc2e75c8ab58ea10f09a85c1e3d6b78b.png)

Can anyone help me out?

Much appreciation in advance !

ps.

On the other example code, I found out that the part is removed, but couldn’t figure out which part of the code enabled the magic…

```auto
import plotly.graph_objects as go

fig = go.Figure(data=[go.Sankey(
    node = dict(
      pad = 15,
      thickness = 20,
      line = dict(color = "black", width = 0.5),
      label = ["A1", "A2", "B1", "B2", "C1", "C2"],
      customdata = ["Long name A1", "Long name A2", "Long name B1", "Long name B2",
                    "Long name C1", "Long name C2"],
      hovertemplate='Node %{customdata} has total value %{value}<extra></extra>',  
      color = "blue"
    ),
    link = dict(
      source = [0, 1, 0, 2, 3, 3], # indices correspond to labels, eg A1, A2, A2, B1, ...
      target = [2, 3, 3, 4, 4, 5],
      value = [8, 4, 2, 8, 4, 2],
      customdata = ["q","r","s","t","u","v"],
      hovertemplate='Link from node %{source.customdata}<br />'+
        'to node%{target.customdata}<br />has value %{value}'+
        '<br />and data %{customdata}<extra></extra>',  
  ))])

fig.update_layout(title_text="Basic Sankey Diagram", font_size=10)
fig.show()

```

 ![Screen Shot 2020-08-03 at 10.51.46 PM](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/8/8978fc07137b57a215e730c102b7d4d6d2690dca.png)

---

<div class="post-metadata">

**Author:** ![bmcarol](https://avatars.discourse-cdn.com/v4/letter/b/f14d63/32.png) [@bmcarol](https://community.plotly.com/u/bmcarol)\
**Post date:** [December 23, 2020, 1:11am UTC](https://community.plotly.com/t/sankey-diagram-how-to-hide-hovering-value-on-link/43327/2 "2020-12-23T01:11:33Z")

</div>

Hi, did you solve this?  
I had the same problem and found it was the part at the end of the hovertemplate that does the magic, although I haven’t figured out how it works…

---

<div class="post-metadata">

**Author:** ![Eduardo](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/eduardo/32/13310_2.png) [@Eduardo](https://community.plotly.com/u/Eduardo)\
**Post date:** [December 23, 2020, 1:34am UTC](https://community.plotly.com/t/sankey-diagram-how-to-hide-hovering-value-on-link/43327/3 "2020-12-23T01:34:23Z")

</div>

### Customizing hover text with a hovertemplate

> **[Hover Text and Formatting](https://plotly.com/python/hover-text-and-formatting/#customizing-hover-text-with-a-hovertemplate)**
>
> How to use hover text and formatting in Python with Plotly.

---

<div class="post-metadata">

**Author:** ![Evgenija](https://avatars.discourse-cdn.com/v4/letter/e/f9ae1b/32.png) [@Evgenija](https://community.plotly.com/u/Evgenija)\
**Post date:** [January 16, 2024, 3:31pm UTC](https://community.plotly.com/t/sankey-diagram-how-to-hide-hovering-value-on-link/43327/5 "2024-01-16T15:31:57Z")

</div>

The part `<extra></extra>` in hovertemplate does the magic of deletion of the value in the red square! Thanks a lot for you as well because your question gave me the right direction!
