Description
Hi,
today I ran into an issue using sankey diagrams in combination with other plots.
This worked just fine in the past, but when I reran notebooks today all plots containing sankeys were broken.
Observed Behavior
I dug a little deeper and found out that the order of the traces affects the success of the plot.
Having sankey as first entry in the Figure.data
list works just fine—otherwise the plot breaks. The sankey is not rendered at all and the coordinates of the other plots are off.
Reproduction
import plotly.offline as py
import plotly.graph_objs as go
from plotly import __version__
py.init_notebook_mode(connected=True)
print(__version__)
sankey = go.Sankey(
domain = go.sankey.Domain(
x = [0, .45]
),
node=go.sankey.Node(
label = ['A', 'B', 'C', 'D']
),
link=go.sankey.Link(
source = [0, 0, 1, 1],
target = [2, 3, 2, 3],
value = [1, 1, 1, 1]
),
)
scatter = go.Scatter(
xaxis='x2'
)
layout = go.Layout(
xaxis2 = go.layout.XAxis(
domain = [.55, 1]
),
annotations = [go.layout.Annotation(
xref='x2',
x = 1,
y = 1,
text = '(1,1)'
)]
)
Then plotting it like this will work:
fig = go.Figure(data = [sankey, scatter], layout = layout)
py.iplot(fig)
Using a different order will fail to render the sankey and throw of the coordinates of the scatter plot.
fig = go.Figure(data = [scatter, sankey], layout = layout)
py.iplot(fig)
I'm assuming this is a bug, as this has worked before just fine.
I'm not sure whether this is an issue with plotly.py
or plotly.js
. Apologies in advance, in case this is the wrong tracker.