Function Repository Resource:

PolarDendrogramPlot

Source Notebook

Plot a polar dendrogram of a clustering

Contributed by: Michael Sollami

ResourceFunction["PolarDendrogramPlot"][list]

constructs a polar dendrogram from the hierarchical clustering of list.

Details and Options

ResourceFunction["PolarDendrogramPlot"] takes the same options as Graphics, as well as the following:
"CircularRange"1.95πthe radians of which to plot (from π to 2π)
DistanceFunctionManhattanDistancethe distance function to use in clustering
"ExpansionFactor"1the amount to compress outer levels of the plot
PlotStyleAutomatica graphics directive to style the plot

Examples

Basic Examples (3) 

Create a simple polar dendrogram plot:

In[1]:=
ResourceFunction["PolarDendrogramPlot"][RandomInteger[100, 50], ImageSize -> 200]
Out[1]=

Compare a normal DendrogramPlot with a PolarDendrogramPlot:

In[2]:=
Needs["HierarchicalClustering`"];
Through[{DendrogramPlot, ResourceFunction["PolarDendrogramPlot"]}[{1, 2, 10, 4, 8}]]
Out[2]=

Style a large PolarDendrogramPlot:

In[3]:=
ResourceFunction["PolarDendrogramPlot"][RandomInteger[10000, 300], "CircularRange" -> 2 \[Pi], ImageSize -> 400,
 PlotRangePadding -> Scaled[.05], PlotStyle -> Directive[Thickness[0.002], Hue[0.2]], Background -> Black]
Out[3]=

Scope (1) 

You can use PolarDendrogramPlot on Cluster objects as well:

In[4]:=
Needs["HierarchicalClustering`"];
c = Quiet@Agglomerate[RandomInteger[10^3, 600]];
Short@c
Out[5]=
In[6]:=
ResourceFunction["PolarDendrogramPlot"][c, ImageSize -> 300]
Out[6]=

Options (1) 

Change the "CircularRange" and "ExpansionFactor" options:

In[7]:=
lst = RandomInteger[5000, 700];
In[8]:=
Manipulate[
 ResourceFunction["PolarDendrogramPlot"][lst, "ExpansionFactor" -> e, "CircularRange" -> c, PlotStyle -> Directive[Hue[0.6]]], {{e, 1.5, "Expansion Factor"}, 1,
   3, Appearance -> "Labeled"}, {{c, 1.7 \[Pi], "Circular Range"}, 3 \[Pi]/2., 2 \[Pi], Appearance -> "Labeled"}]
Out[8]=

Possible Issues (1) 

Many of of the options supported by DendrogramPlot are not supported in PolarDendrogramPlot:

In[9]:=
list = RandomInteger[20, 10];
In[10]:=
Through[{DendrogramPlot, ResourceFunction["PolarDendrogramPlot"]}[
  list, LeafLabels -> (# &)]]
Out[10]=

Publisher

Michael Sollami

Version History

  • 1.0.0 – 25 March 2020

Related Resources

License Information