Closed
Labels
bugsomething broken
Description
Here is the codepen for the reported bug: https://codepen.io/rbakker/pen/gBjXde
The pen shows two plotly plots with Sankey diagram with the same data.
The only difference is that the first plot uses node.pad = 10, the second uses node.pad = 2.
In the first plot the nodes are not drawn at all.
Activity
nicolaskruchten commentedon Oct 23, 2018
(reported via support channels)
alexcjohnson commentedon Oct 23, 2018
Interesting... what's happening is we need to generate a node/link thickness scaling, and we do so by taking the height of a column, subtracting off n-1 paddings (for n nodes in that column), and scaling all nodes so the sum of their thicknesses fills the remaining space.
The problem is that the requested padding is more than the available space, so the scaling factor goes negative, and apparently we never considered this possibility before. The way we appear to draw it, negatively scaled nodes get zero height, and negatively scaled links get drawn with the absolute value of the scaling (but misaligned because we weren't expecting this)
I suppose the solution would be something like limit the padding to at most occupy perhaps half the space in any given column? 2/3?
antoinerg commentedon Oct 23, 2018
@alexcjohnson Should we give a warning (
Lib.warn) if the user specified value is too big?alexcjohnson commentedon Oct 23, 2018
Mmm yeah, good idea -
Lib.warnif the actual padding is less than requested. 👍 That's probably better (and certainly easier) than trying to push the calculated value back intofullData(in a way that's compatible withPlotly.react...)