0

I am creating a Sankey Chart. Sample code

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, A1, 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()

Now when I hover over the nodes it shows the incoming, outgoing and node name. It also shows me the value of the node. For example in this case we have A1, incoming flow count = 0, outgoing flowcount = 2. At the end it also shows the value 10. Sankey Chart Hovertext I need the value 10 to be shown permanently beside the nodes. How do I do that ? The hovertext disappears when I am trying to paste the plot in a ppt. I need the hovertext visible at all times.

Abhishek Pal
  • 141
  • 4

0 Answers0