Black Lives Matter. Please consider donating to Black Girls Code today.

Unable to generate sankey plot using below code

I am trying to plot Sankey using code( for my offline plot. But I am not getting the image displayed but layout is displayed. fig is also having parameters.

My code:

Links is my dataframe with source, target, value and color columns

import plotly
import json, urllib
import plotly.plotly as py
import urllib, json


data_trace = dict(
width = 1118,
height = 2000,
domain = dict(
x = [0,1],
y = [0,1]
orientation = “h”,
valueformat = “.0f”,
# valuesuffix = “TWh”,
node = dict(
pad = 15,
thickness = 15,
line = dict(
color = “black”,
width = 0.5
color = links[‘color’]
link = dict(
source = links[‘source’],
target = links[‘target’],
value = links[‘value’],
color = links[‘color’]


layout = dict(
title = “Call types flow through categories for first five calls for Digicel- Jamaica (Jan 2017-June 2017)”,
font = dict(
size = 10

fig = dict(data=[data_trace], layout=layout)
plotly.offline.iplot(fig, validate=False)

Please help me out !!

Hi @khari14,

Could you please repost your code in a “Fenced code block” (See This keeps the markdown renderer from messing up the formatting, so that people can copy and paste your code to try it out.