Function Repository Resource:

# SectorTreePlot

Plot tree data in stacked angular sectors

Contributed by: Giulio Alessandrini
 ResourceFunction["SectorTreePlot"][tree] plots the data in tree stacking child sectors radially.

## Details and Options

SectorTreePlot can take all the options of Graphics with the following additions and modifications:
 ColorFunction Automatic how to color the sectors Method Automatic how to build the sectors TreeElementLabelFunction Automatic how to label the sectors
The argument of the color function is an association with the following keys:
 "Angle" the {min,max} angles of a sector (0,2π] "Data" the tree data "Label" the label speficied by the label function "Level" the tree level "Position" the tree position "Step" the {min,max} angular step of a sector (0,1] "Tree" the full input tree
The default color function is Hue[Mean[params["Step"]],1/params["Level"]+.3,.95] for positive levels and GrayLevel[.3] at level zero.
Possible values for Method are:
 "Fixed" assign the same angular space to each child "Value" assign space propotionally to the child data
The default TreeElementLabelFunction is Row[{edge,": ",data}] for labelled parent edges and simply data for unlabelled edges.

## Examples

### Basic Examples (1)

Plot the tree data in nested sectors:

 In[1]:=
 Out[1]=

### Options (7)

#### Background (1)

Use a custom background:

 In[2]:=
 Out[2]=

#### ColorFunction (3)

Use a hue that scales inversely with the level:

 In[3]:=
 Out[4]=

Use a hue proportional to the angle:

 In[5]:=
 Out[5]=

Use a hue proportional to the scaled position:

 In[6]:=
 Out[6]=

These two are equivalent for equal size sectors:

 In[7]:=
 Out[7]=

Create a grayscale plot:

 In[8]:=
 Out[8]=

#### Method (3)

By default, a numerical tree is plotted with sector angles proportional to the tree data:

 In[9]:=
 Out[9]=

 In[10]:=
 Out[10]=

By default, a mixed numerical and non-numerical tree uses proportional angles when all the children of a tree have numerical data:

 In[11]:=
 Out[11]=

Force equal angles:

 In[12]:=
 Out[12]=

It is not possible to used proportional angles in this case:

 In[13]:=
 Out[13]=

By default, a mixed non-numerical tree uses equal angles:

 In[14]:=
 Out[14]=

### Applications (2)

Build a tree from a nested symbolic expression:

 In[15]:=
 Out[15]=

Build a tree from a nested symbolic expression:

 In[16]:=
 Out[16]=

Build a tree of a region of the file system:

 In[17]:=
 Out[17]=

Compute the size of all the files (the tree leaves):

 In[18]:=
 Out[18]=

Propagate the size up the tree:

 In[19]:=
 Out[19]=

Plot the tree in sectors:

 In[20]:=
 Out[20]=

## Version History

• 1.0.0 – 01 May 2023