Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Requested]: Sunburst direction #5341

Closed
DaniMori opened this issue Dec 12, 2020 · 17 comments
Closed

[Feature Requested]: Sunburst direction #5341

DaniMori opened this issue Dec 12, 2020 · 17 comments

Comments

@DaniMori
Copy link

Similarly to the Rotation or starting point, a direction argument (with values "clockwise" (by default) and "counterclockwise") would be desirable.

@DaniMori DaniMori changed the title [Feature request] Sunburst direction [Feature Requested]: Sunburst direction Dec 12, 2020
@thierryVergult
Copy link
Contributor

Please note that a sort (boolean) parameter was added recently to Sunburst trace. By setting that parameter to false, you can order the data at your end, in the direction desired.

sunburst sort

@DaniMori
Copy link
Author

Thanks for the info! I understand this does not solve the issue completely, I think; although it may allow ordering the categories in reverse, the change does not propagate to the animations for opening/closing the plot levels.

@usser123
Copy link

In relation to this issue, I tried to add the line 'sort': False in the trace of a Plotly sunburst chart. However, it does not seem to work. The order of labels in the chart was not the order in the dataframe. The order seemed to be changed by Plotly.

Is there any ETA for this issue ?

@xeladsn
Copy link

xeladsn commented Jul 13, 2021

Did you try to build your figure with graph_objects and not plotly express ?

It seems that Plotly Express applies an unwanted sort on path columns when using px.sunburst.

@usser123
Copy link

@xeladsn, I am using the Plotly Express generated meta data but creating the sunburst by using that meta data in graph_objects. Based on this link:

https://stackoverflow.com/questions/61241172/plotly-how-to-create-sunburst-subplot-using-graph-objects/61245407#61245407

Any idea, how to get the sort disabled ?

@xeladsn
Copy link

xeladsn commented Jul 14, 2021

@usser123 I would recommend using graphs_objects and not Plotly Express to create your sunburst trace if you want to keep the data order. Here is a basic example why on the image below (data order is ['a', 'c', 'b', 'd']) :

sunburst_order

Plotly Express appears to reorder the data for the column named cat, even if sort=False have been applied to the figure traces.

As this odd behavior does not relate to the current topic let's create a new issue if you confirm that sort=False works well for your use case if you use graph_objects.

@usser123
Copy link

@xeladsn, I am using Plotly Express generated labels and parents in my graph_objects chart. It is quite laborious to specify labels and parents in graph_objects directly. So the issue does exist for me.

The issue for this already exists in github:
#5164

@xeladsn
Copy link

xeladsn commented Jul 19, 2021

The issue you mentions (#5164) was related to the order for the sunburst trace. It is already fixed and merged. The re-ordering that appears for your use case is related to Plotly Express only, and not to the sunburst trace sort attribute (see image attached in my last message).

I think you can't disable that custom ordering when using Plotly Express. This is an issue, but should be addressed separately as it seems to be unrelated to the sunburst trace sort attribute.

@usser123
Copy link

Ok, I did not realize that re-ordering and sort are different things. In that case, yes this is a separate issue.

@nickriches
Copy link

Really interested in getting the sorting to work properly on this.

@Skrattoune
Copy link

Is there any advance there?

This is extremely annoying that the default displaying order is counterclockwise ... as most people on earth are used to ... clockwise as the default functioning for about everything (starting with clocks)

This is definitively a very different topic than "sorting"
The easily visible issue is that when sorting is enabled, data are sorted counterclockwise ... instead of the cross-industry standard which is ... clockwise !

@nicolaskruchten
Copy link
Contributor

There is no "advance" to be reported here, no. Things advance when people step up to work on them and no one has done so to date. Expressing your annoyance at the status quo does not particularly encourage anyone to do so either.

@nicolaskruchten
Copy link
Contributor

I'll note that it kind of seems like the issue being reported here is with Plotly Express' behaviour, not Plotly.js' ... this might be a better fit for a Plotly.py issue: https://github.com/plotly/plotly.py/

@Skrattoune
Copy link

There is no "advance" to be reported here, no. Things advance when people step up to work on them and no one has done so to date. Expressing your annoyance at the status quo does not particularly encourage anyone to do so either.

No annoyance ;-) I'm new to Plotly and find it super cool.
Just want to know the status because I had spent a lot of time on understanding what was my problem ... until I finally made it here.

Happy to help solve the problem if I can as I have a real need there.

'll note that it kind of seems like the issue being reported here is with Plotly Express' behaviour, not Plotly.js' ... this might be a better fit for a Plotly.py issue: plotly/plotly.py

I'll have a look, thanks

@nicolaskruchten
Copy link
Contributor

OK. Here is where Plotly Express converts between the input data frame and the structure which go.Sunburst requires. Any changes to how things are sorted would need to be made here. https://github.com/plotly/plotly.py/blob/master/packages/python/plotly/plotly/express/_core.py#L1543

@DaniMori
Copy link
Author

I'll note that it kind of seems like the issue being reported here is with Plotly Express' behaviour, not Plotly.js' ... this might be a better fit for a Plotly.py issue: https://github.com/plotly/plotly.py/

Actually I opened this issue because I was working with the R plotly package; I understood this behavior affected the whole plotly.js library, but maybe I got confused with the R package interface... Is that so?

@gvwilson
Copy link
Contributor

gvwilson commented Jul 5, 2024

Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson

@gvwilson gvwilson closed this as completed Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants