This seems like a bug, so any help in reproducing it would go a long way towards a fix
No I havenāt unfortunately! at least I know itās not just me. Mine also worked on a smaller dataset, I donāt understand the issue as mine isnāt a particularly large plot it only has two layers.
By any chance did you also have repetitive labels on any of the layers?
Could you be more specific as to exactly what you would like to see? Iāve already shared the data Iām using, any attempt to plot a bare simple sunburst it with branchvalues =totals fails
To reproduce the bug I would need the data in copy-pasteable text form rather than as a screenshot, actually
Also, I wonder if the duplicate IDs in your data might be causing a problemā¦
I believe all ids are unique? the above data is created within an R script that pulls data from different sources, I will save it to excel and try to share it on here
meanwhile there is another post here, with the data, encountering the same issue: Plotly Sunburst returning empty chart with branchvalues = 'total'
I have loads of duplicate labels throughout the layers and I use the ids
array to overcome that. I actually figured out a work around for my particular problem. I use remainder
instead of total
and set the weights in the values
array. I wanted the wedges to be symmetrical on all layers and for the wedges to take up the entire circle. However, because my data set is very large (about 18,000 nodes) there was a lot of math, graph theory and headaches involved in my solution.
Apologies, so I slightly edited the data as some of is sensitive. In that case thereās two projects that share the same first name. E.g. BSTD project1 BSTD project2
Iāve re-run the original script without any duplicates, still having the same issue.
OK. I still canāt reproduce this problem locally so if anyone can post a replicable example Iād be grateful
Iāve tried the sample data from https://community.plotly.com/t/26582 (over in the R forum) but those all work in Python with Plotly v4.2.1:
import plotly.graph_objects as go
go.Figure(
go.Sunburst(
labels = ["Seth", "Enos", "Noam", "Awan", "Enoch"],
parents = ["", "Seth", "Seth", "", "Awan"],
values = [12, 10, 2, 4, 4],
branchvalues="total"
)
)
and
import plotly.graph_objects as go
go.Figure(
go.Sunburst(
ids = [1, 2, 3, 4, 5, 6, 7, 8, 9, "1 - a", "1 - b", "2 - a", "2 - b", "3 - a", "3 - b", "4 - b", "5 - a", "5 - b", "6 - a", "6 - b", "7 - a", "7 - b", "8 - a", "8 - b", "9 - a", "9 - b"],
labels = ["Group 1", "Group 2", "Group 3", "Group 4", "Group 5", "Group 6", "Group 7", "Group 8", "Group 9", "a", "b", "a", "b", "a", "b", "b", "a", "b", "a", "b", "a", "b", "a", "b", "a", "b"],
parents = ["", "", "", "", "", "", "", "", "","1", "1", "2", "2", "3", "3", "4", "5", "5", "6", "6", "7", "7", "8", "8", "9", "9"],
values = [195, 99, 2425, 3, 379, 5182, 48, 3119, 903, 37, 158, 15, 84, 561, 1864, 3, 67, 312, 915, 4267, 19, 29, 433, 2686, 51, 852]
, branchvalues="total"
)
)
If youāre able to look in the Javascript console, it usually gives a helpful-ish error when this fails, like this for example:
Thanks, this is helpful as what I found most difficult about working with Plotly is not getting error messages to aid debugging.
How do I access the JavaScript console in R? Iāve had a quick Google
I also had this issue. I found that plotly is temperamental when it came to float values. When I rounded them to ints, it worked fine
Someone else from my organisation has also come to me with the same issue. Which is a shame as it is one of the best sunburst plots out there.
Clearly reproducing this issue isnāt a problem tho
@nicolaskruchten I believe I was able to reproduce the behavior described. Iām using Plotly in a Python/JupyterLab environment. If I use the Eve sunburst example in a notebook cell with the branchvalues attribute removed, I get the following:
If I then add the branchvalues=True attribute, I will get a blank plot output. As shown below:
I took a look at the browser console during both cell executions and got two plotly.js errors when the blank plot was created. Below are the errors:
plotly.js:25536 Error: attribute d: Expected number, āMNaN,NaNLNaN,NaNAā¦ā.
plotly.js:25529 Error: attribute transform: Expected number, ātranslate(NaN,NaN)translatā¦ā.
BTW and forgot to mention in my first post, this happens on both Plotly v4.1.0 and V4.3.0.
Thanks very much @kev.mock! Iām unable to replicate this locally in either JupyterLab or classic Notebooks, which is pretty strange! The same code also works in straight plotly.js in a CodePen, so thereās something else going on here.
Ah I think I know whatās happening here. This happens with Plotly.js version 1.49.4, which shipped with Plotly.py 4.1.0. Itās possible you would still see this in Plotly.py 4.3.0 in JupyterLab if you havenāt updated your labextensions ā¦ Please check out our Getting Started guide for installation instructions for the JupyterLab extensions, which must be upgraded alongside the plotly
module in order to get access to the latest features and bugfixes.
@nicolaskruchten Yep you are correct. I updated to 4.3.0 of Plotly but didnāt update the lab extension. After the labextension update, the plots are working normally. Thanks for the help!