Plotly.js: branchvalues='total' too strict

Created on 3 Dec 2019  路  3Comments  路  Source: plotly/plotly.js

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?

bug

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

All 3 comments

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

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 :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tim-sauchuk picture tim-sauchuk  路  3Comments

mithi picture mithi  路  3Comments

n-riesco picture n-riesco  路  3Comments

WG- picture WG-  路  3Comments

boleslawmaliszewski picture boleslawmaliszewski  路  3Comments