It seems to be a common problem when using sunburst and treemap from Python and R that the values sum up in the original language but not in JS after passing through JSON, with errors in the 1e-14 range, e.g. https://codepen.io/nicolaskruchten/pen/MWYYJba
How about we accept the data if the difference is, say, less than 0.01% of the parent?
Let's use 1ppm difference. We have a constant for this - only used one other place ATM but at least it's a precedent:
Sure, I prefer 1ppm over 1%, at least visually we cannot make the difference (and in my experience multiplying each child weight by 1+1e-15 when computing the parent weight appears to be enough to fix the issue, so 1ppm is probably more than enough).
Also I was wondering if
1) we could get an error message on the plot when this kind of problem arises (with a blank plot I was not sure what the problem was)
2) or, maybe it would be just ok to show a parent that is smaller than the sum of children? (i.e. the opposite of what we have at https://plot.ly/python/sunburst-charts/#basic-sunburst-plot)
we could get an error message on the plot when this kind of problem arises (with a blank plot I was not sure what the problem was)
There is an error message in the javascript console already, but it's very challenging for us to build a system to get access to those messages from Python or R. See https://github.com/plotly/plotly.py/issues/1967 for a possible technical approach.
or, maybe it would be just ok to show a parent that is smaller than the sum of children? (i.e. the opposite of what we have at https://plot.ly/python/sunburst-charts/#basic-sunburst-plot)
It's not clear what that would actually look like if the parent is visibly smaller than the children :)
Most helpful comment
Let's use 1ppm difference. We have a constant for this - only used one other place ATM but at least it's a precedent:
https://github.com/plotly/plotly.js/blob/fb8b28a552a5f83456d44be7dc1ff390146edaee/src/constants/numerical.js#L47-L50