Shimoku docs
Search…
⌃K

Sunburst

The Sunburst diagram is a space-filling visualization that uses a radial rather than a rectangular layout. In Sunburst, items in a hierarchy are laid out radially, with the top of the hierarchy at the center and deeper levels farther away from the center.
The circle in the center represents the root node, with the hierarchy moving outward from the center.

The method to use

The method is shimoku.plt.radar()
It must contain the following input variables:
data: List[Dict]
menu_path: str
order: int
And accepts the following input variable as optional:
title: Optional[str]
rows_size: Optional[int]
cols_size: Optional[int]
padding: Optional[List[int]]

Examples

1. Default configuration

data_ = [
{
"name": "Root 1",
"children": [
{
"name": "Child A",
"value": 13,
"children": [
{
"name": "Child A1",
"value": 2
},
{
"name": "Child A2",
"value": 5,
"children": [
{
"name": "Child AA1",
"value": 2
}
]
},
{
"name": "Child T2",
"value": 4
}
]
},
{
"name": "Child B",
"value": 6,
"children": [
{
"name": "Child B1",
"value": 5
},
{
"name": "Child B2",
"value": 1
}
]
}
]
},
{
"name": "Root 2",
"children": [
{
"name": "Child A1",
"children": [
{
"name": "Child AA1",
"value": 1
},
{
"name": "Child AA2",
"value": 2
}
]
}
]
}
]
shimoku.plt.sunburst(
data=data_,
name='xAxis', children='children', value='value',
menu_path='sunburst-1',
order=0,
rows_size=3, cols_size=12,
)
The result is like this:
The Sunburst chart in the default configuration.
The chart has tooltips, when you hover the mouse over the figure, for example in this figure, you can see:
The mouse is on the Root 2, showing its children.

2. Title for the chart, changing data, size, and padding

data_ = [
{
"name": "P. strobus",
"children": [
{
"name": "Sector A",
"value": 9,
"children": [
{
"name": "Sector A1",
"value": 2
},
{
"name": "Sector A2",
"value": 7
}
]
},
{
"name": "Sector B",
"value": 8,
"children": [
{
"name": "Sector B1",
"value": 5
},
{
"name": "Sector B2",
"value": 3
}
]
}
]
},
{
"name": "P. rigida",
"children": [
{
"name": "Sector A",
"children": [
{
"name": "Sector A1",
"value": 7
},
{
"name": "Sector A2",
"value": 3
}
]
}
]
}
]
shimoku.plt.sunburst(
data=data_,
name='xAxis', children='Sector', value='value',
menu_path='sunburst-2',
title='Pine trees in each Sector',
order=0, rows_size=3, cols_size=8,
padding='0,0,0,1',
)
The result is:
Note the space before the component with padding, the title='Pine trees in each Sector', the size with rows_size=3, cols_size=8.
Depending on the size of the text to include in the segments, it is possible to use rows_size=2 and get a complete chart, without any text misplacement.
The tooltips allow us to see that there are 7 pine trees of the species Pinus strobus in the Sector A2:
Using the tooltip.
Changing menu_path The menu_path can be modified.
It is possible to use any number of rows.
Last modified 9mo ago