What are Treemaps? Treemaps display hierarchical (tree-structured) data as a set of nested rectangles Each branch of the tree is given a rectangle, which is then tiled with smaller rectangles representing sub-branches A leaf node's rectangle has an area proportional to a specified dimension on the data The leaf nodes are colored to show a separate dimension of the data
Standard Treemaps The standard Treemaps algorithm just did the transition from hierarchical data to its representation in the rectangular form An example:
Standard Treemaps pseudo code The tree-map algorithm assumes a tree structure in which each node contains a record with its directory or file name (name), the number of children (num_children), and an array of pointers to the next level (child [1..num_children]). The arguments to the tree-map algorithm are: root : a pointer to the root of the tree or subtree P, Q : arrays of length 2 with (x,y) coordinate pairs of opposite corners of the current rectangle (assume that Q contains the higher coordinates and P the lower coordinates, but this does not affect the correctness of the algorithm, only the order in which rectangles are drawn) axis : varies between 0 and 1 to indicate cuts to be made vertically and horizontally color: indicates the color to be used for the current rectangle.
Standard Treemaps pseudo code In addition we need: Paint_rectangle : a procedure that paints within the rectangle using a given color, and resets the color variable. Size : a function that returns the number of bytes in the node pointed to by the argument. Alternatively, the size could be pre-computed and stored in each node. The initial call is: Treemap(root, P, Q, 0, color) Where P and Q are the upper right and lower left corners of the display. By setting the axis argument to zero the initial partitions are made vertically. It is assumed that arguments P and Q are passed by value (since P, Q are modified within
Standard Treemaps pseudo code Treemap(root, P[0..1], Q[0..1], axis, color) Paint_rectangle(P, Q, color) -- paint full area width := Q[axis] - P[axis] -- compute location of next slice for i := 1 to num_children do Q[axis] := P[axis] + (Size(child[i])/Size(root))*width Treemap(child[i], P, Q, 1 - axis, color) -- recur on each slice, flipping axes P[axis] := Q[axis]; endfor
Problem with standard Treemaps Treemaps often fall short to visualize the structure of the tree Thin, elongated rectangles emerge as a result of the srtaight forward subdivision technique of standard treemaps The second problem can be solved by using a modified version of standard treemaps algorithm called: “SquarifiedTreemaps”
SquarifiedTreemaps Instead of rectangles, in this algorithm we try do reduce the aspect ratio as much as possible and hence squarifytreemaps. Reason being: Display space is used more efficiently. The number of pixels to be used for the border is proportional to its circumference. For rectangles this number is minimal if a square is used Square items are easier to detect and point at Comparison of the size of rectangles is easier when their aspect ratios are similar
Squarification in practice We initially start with a 6x4 rectangle and add areas 6,6,4,3,2,2,1 to it. At each addition we make sure we have the maximum aspect ratio By standard treemaps algorithm:
Squarification in practice With squarification:
Final layer to treemaps The squares can be colored to represent an extra dimensions The area/size can be represented using any parameter as per the requirement
Using the DA-API to execute treemaps
Using the DA-API to execute treemaps Again to use the API we just need to figure out the correct entity and the message type Looking at the specification the entity is RootTreeMapTaskInfo The task will be completed in a sequence of multiple messages, as specified on the website As the task is used for data visualization so it does not produce any type of result
Message sequence The steps are:
Treemaps using Data Applied’s web interface
Step1: Selection of data
Step2: Selecting Tree Maps
Visit more self help tutorials
Pick a tutorial of your choice and browse through it at your own pace.
The tutorials section is free, self-guiding and will not involve any additional support.