Hi Team,
- I have below dataframe.
source,target,count
SCM,SOC,39
SOC,Open SOC Page,39
Open SOC Page,Expand Display Option,2
Open SOC Page,Expand Export,3
Open SOC Page,Hide Direct Report,2
Open SOC Page,Level Up,1
Open SOC Page,Open Position Card,2
Open SOC Page,Open SOC Page,7
Open SOC Page,People Search,15
Open SOC Page,Position Search,2
Open SOC Page,View Less,2
Open SOC Page,exit,3
Expand Display Option,SCM.SOC.SWITCH_REPORT_TYPE,1
Expand Display Option,Switch Show on Card,1
Expand Export,Hide Direct Report,1
......
......
- I have below code to generate sankey
import plotly.graph_objects as go
from plotly.offline import plot
import pandas as pd
import plotly as py
# read the file
df = pd.read_csv('sankey.csv')
labelListTemp1 = list(set(df['source'].values))
labelListTemp2 = list(set(df['target'].values))
labelListTemp = labelListTemp1 + labelListTemp2
# remove duplicates from labelList
sankey_node = list(dict.fromkeys(labelListTemp))
sankey_source = df['source']
sankey_target = df['target']
sankey_value = df['count']
fig = go.Figure(data=[go.Sankey(
node = dict(
pad = 15,
thickness = 20,
line = dict(color = "black", width = 0.5),
label = sankey_node,
color = "blue"
),
link = dict(
source = sankey_source, # indices correspond to labels, eg A1, A2, A2, B1, ...
target = sankey_target,
value = sankey_value
))])
fig.update_layout(title_text="Basic Sankey Diagram", font_size=10)
py.offline.plot(fig)
- The environment is Anaconda->Spyder, after I run the code, onthely the chart title is displayed, the sankey chart is not displayed. Can you help advise whatโs wrong here?