plotly / plotly.py

The interactive graphing library for Python :sparkles: This project now includes Plotly Express!
https://plotly.com/python/
MIT License
15.98k stars 2.53k forks source link

add Interactive Legends for Plotly Express Sunburst Charts #4692

Open mlouis9 opened 1 month ago

mlouis9 commented 1 month ago

Motivation

I'm a huge fan of Plotly Express Sunburst charts, but when viewing data with lots of small proportions (that are meaningful), it can be difficult to expand individual wedges because they're so small.

A Solution

I think it might be nice if there was a scrollable, clickable legend listing all of the inner wedges of the pie chart. I've included an an example .html spec that I hacked together by wrapping the plotly html. Clicking on the label in the legend expands the corresponding wedge in the sunburst chart. I'm not sure how feasible something like this is, but I think it might be a nice feature.

archmoj commented 1 month ago

Is this the duplicate of https://github.com/plotly/plotly.js/issues/4760?

mlouis9 commented 1 month ago

Not quite; the suggested addition is to deal with wedges that are too small to click on by hovering over them by adding an interactive legend showing the inner wedges of the sunburst. As far as I can tell by looking at the example in the linked issue, it doesn't implement the type of legend included in the html spec I linked here and still has issues with small wedges.