Simon P. Ditner > Treemap > Squarified

Download:
Treemap-0.2.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

Squarified Explained

SYNOPSIS ^

Make a Treemap, SQUARIFIED!!!

DESCRIPTION ^

First, we sort the list of nodes at our current depth based on their area (or size), in descending order.

We then take the first node and find the aspect ratio for it's required area, then compare that to the aspect ratio of the first and second node added together, and so on, until the aspect ratio become non-ideal (when it exceeds one).

e.g.

The aspect ratio, W/H, in this case is < 1, so we would like to maximize our width 'X' to 'W' for area 'A', and then expand the height 'Y', until our area 'A' has the aspect ratio closest to 1.

     <---- W ---->     Calculating the Aspect ratio:

 ^   +-----------+     We know the value of A, and W
 |   |+---------+|     We also know that X = W
 |   ||         ||     
 |   ||    A    Y|     Therefore:  
 |   ||         ||           A = XY
 H   |+----X----+|           A = WY
 |   |           |           Y = A/W
 |   |           |
 |   |           |      Aspect = Width / Height
 V   +-----------+      Aspect = W / ( A / W )        
                        Aspect = W^2 / A

We would calculate the 'Aspect Ratio' of Node1 with area A1, and compare it to the 'Aspect Ratio' of Node 1 and Node 2, with area (A1+A2). Further nodes are added, until the aspect ratio becomes non-ideal.

If we were to plot the 'Aspect Ratio' as 'Y' was increased, we would get:

 Aspect
   |        ./
 1 |      ./ 
   |    ./  
   |  ./   
   |./    
   +---------- Y
 0        

If instead we take the inverse of the 'Aspect Ratio' when it is less than one, we would get:

 Aspect
   |
   | \      /
   |  \    /
   |   \  /
   |    \/
   +---------- Y
 1        

This makes it easier to compare two aspect ratios when they span the perfect aspect ratio of 1.

AUTHORS ^

Simon P. Ditner <simon@unitycode.org>, Eric Maki <fish@unitycode.org>

Original Treemap Concept: Ben Shneiderman <ben@cs.umd.edu>, http://www.cs.umd.edu/hcil/treemap-history/index.shtml

Squarified Treemap Concept: Visualization Group of the Technische Universiteit Eindhoven

BUGS ^

None yet :P

SEE ALSO ^

Treemap

COPYRIGHT ^

(c)2003

syntax highlighting: