Plotly is a Python library which is used to design graphs, especially interactive graphs. It can plot various graphs and charts like histogram, barplot, boxplot, spreadplot and many more. It is mainly used in data analysis as well as financial analysis. plotly is an interactive visualization library.
Sunburst Plot using graph_objects class
If Plotly Express does not render a good starting point, it is also accessible to custom from the more generic go.Sunburst class from plotly.graph_objects.The sunbrust is the prototype for exhibit hierarchical data.Each level of the hierarchy is represented by one ring or circle with the innermost circle as the top of the hierarchy.The sunbrust chart without any hierachical data looks similar to doughnut chart.
Syntax: class plotly.graph_objects.Sunburst(arg=None, branchvalues=None, count=None, customdata=None, hoverinfo=None, **kwargs)
arg: dict of properties compatible with this constructor or an instance of plotly.graph_objects.Sunburst
branchvalues: Determines how the items in values are summed.
count: Determines default for values when it is not provided, by inferring a 1 for each of the “leaves” and/or “branches”, otherwise 0.
customdata: Assigns extra data each datum. This may be useful when listening to hover, click and selection events. Note that, “scatter” traces also appends customdata items in the markers DOM elements
hoverinfo: Determines which trace information appear on hover. If none or skip are set, no information is displayed upon hovering. But, if none is set, click and hover events are still fired.
With branchvalues “total”, the value of parent to represent the width of the wedge. With branchvalues “remainder”, the parent width is demarcate by its own values plus the value of children.The sum of the children cannot exceed to the sum of the parent when the branch values are set to be “total”.Lets see an example to get know more about it, shown below:
Presenting Large Number of Slices
In plotly, the sunbrust chart have several slices in its pie which helps to present the data more understandable and in efficient way, as each column of the data is separated through different colors.Various data slices can be built in a single pie which lead to take less space in layout.Lets see an example which is given below
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course