Hi, as the title says whenever I’m saving a Sankey graph no matter if it’s large or small it always produces a blank svg. Is there a way to solve this issue? The graph display normally in my jupyter notebook but saves a blank svg (only title is visible).
I’m using plotly 3.6.1
def drawSankeyForAreaFlow(area_flow_data, log_index):
sankeyData = getSankeyData(area_flow_data)
data = dict(
type='sankey',
node = dict(
pad = 30,
line = dict(
width = 0.5
),
label = ['label 1', 'label 2', 'label 3', 'label 4', 'label 5', 'label 6', 'label 7', 'label 8', 'label 9', 'label 10', 'label 11', 'label 12', 'label 13', 'label 14', 'label 15', 'label 16'],
color = ['#FF40C5', '#FF4A80', '#FF713D', '#FF9600', '#E5B200', '#A4C700', '#47D400', '#00DB65', '#00DFAE', '#00E1F5', '#00DEFF', '#00D6FF', '#00C7FF', '#58AEFF', '#EA8BFF', '#FF61FF', '#FF40C5']
),
link = dict(
source = [0, 2, 2, 2, 2, 2, 3, 4, 4, 4, 5, 8, 8, 9, 11, 12, 12, 14, 14, 15, 15, 15, 15, 15],
target = [2, 4, 5, 11, 12, 15, 9, 4, 12, 15, 2, 2, 4, 0, 3, 0, 2, 8, 14, 0, 4, 12, 14, 15],
value = [6, 2, 1, 1, 2, 2, 1, 1, 1, 5, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 3, 2, 1, 6]
))
layout = dict(
title = "Sankey for log " + str(log_index),
font = dict(
size = 10
)
)
fig=go.Figure(data=[data],layout=layout)
pio.write_image(fig, "./output/graphs/" + "Sankey for log " + str(log_index) + ".svg")
plotly.offline.iplot(fig, validate=False)
return {'sources': sankeyData['sources'], 'targets': sankeyData['targets'], 'values': sankeyData['values']}
allSankeyData = []
for i, log in enumerate(logs):
allSankeyData.append(drawSankeyForAreaFlow(log["properties"]["area_flow"], i))