EXAMENSARBETE INOM DATATEKNIK, AVANCERAD NIVÅ, 30 HP STOCKHOLM, SVERIGE 2017

Tiling heuristics and evaluation metrics for treemaps with a target node aspect ratio

RODRIGO ROA RODRÍGUEZ

KTH SKOLAN FÖR DATAVETENSKAP OCH KOMMUNIKATION Tegell¨aggningsheuristiker och evalueringsm˚att f¨or treemaps med ett m˚alsatt bredd-h¨ojd-f¨orh˚allande f¨or noder

Sammanfattning

Treemaps ¨ar popul¨ara rymd-e↵ektiva visualiseringar av hierarkisk da- ta som mappar ett datums attribut eller aggregat till en proportionell area. Med en treemap som best˚ar av rekursivt inb¨addade rektangul¨ara noder (ocks˚akallade f¨or tegel) finns det m˚angam¨ojliga och giltiga te- gell¨aggningar.

Ett vanligt optimeringskriterium f¨or treemaps ¨ar bredd-h¨ojd-f¨orh˚allande f¨or noder. D˚atreemaps best˚ar av ett flertal noder m˚aste breddf¨orh˚allandet aggregeras.

Den grundl¨aggande definitionen av breddf¨orh˚allande (bredd delad med h¨ojd) kan inte aggregeras p˚aett meningsfullt s¨att. I litteraturen f¨oresl˚as d¨arf¨or en definition av bredd-h¨ojd-f¨orh˚allande som inte skiljer mellan h¨ojd och bredd. Denna definition m¨ojligg¨or betydelsefull aggregering, men en- bart om det inte finns stora skillnader i v¨arde mellan dataelement och det m˚alsatta bredd-h¨ojd-f¨orh˚allandet ¨ar 1:1.

Ett m˚al bredd-h¨ojd-f¨orh˚allande p˚a1:1 antogs ursprungligen axiomatiskt vara optimalt i litteraturen. D¨arefter har perceptuella studier visat att just detta f¨orh˚allande leder till det st¨orsta areauppskattningsfelet.

Detta examensarbete f¨oresl˚ar en korrigerad version av m˚attet som kan anv¨andas ¨aven n¨ar det finns stora skillnader i v¨arde mellan dataelement. D¨arut¨over har b˚ade det ursprungliga och det korrigerade m˚attet genera- liserats s˚aatt de fungerar med ett godtyckligt m˚alv¨arde.

Ytterligare ett bekymmer med avseende p˚aevalueringsmetodik ¨ar att tegell¨aggningsalgoritmer har ¨an s˚al¨ange evaluerats med Monte Carlo- metoden. I denna metod genereras syntetisk data och som sedan aggre- geras till ett slutgiltigt resultat. D¨aremot kan ett enda v¨arde inte sam- manfatta en algoritms beteende d˚adess prestanda ¨ar beroende p˚avil- ken v¨ardef¨ordelning datan har. Alternativet som f¨oresl˚as p˚adetta exa- mensarbete ¨ar visuell klusteranalys som p˚ast˚as ha en st¨orre f¨oruts¨agande f¨orm˚aga.

Allt det ovann¨amnda realiseras via ett experiment. I experimentet evalue- ras en ny art av algoritmer, som har baserats p˚aresultaten av perceptuella tester i litteraturen, i j¨amf¨orelse mot den nuvarande mest popul¨ara te- gell¨aggningsalgoritmen: Squarify. Resultaten visar att det finns stora men sammanh¨angande skillnader p˚av¨arde beroende p˚avilken f¨ordelning datan har. Atminstone˚ f¨or ett m˚al p˚a1,5 och vid de allra flesta f¨ordelningarna visar det sig att de nya algoritmerna presterar b¨attre ¨an Squarify med avseende p˚adet resulterande bredd-h¨ojd-f¨orh˚allandet. Tiling heuristics and evaluation metrics for treemaps with a target node aspect ratio

Rodrigo Roa Rodríguez School of Computer Science and Communication, KTH Royal Institute of Technology [email protected]

ABSTRACT are shown to perform better than Squarify for most use cases Treemaps are a popular space-filling of hierar- in terms of aspect ratio. chical data that an attribute of a datum, or a data aggre- gate, to a proportional amount of area. Assuming a rectangu- lar treemap consisting of nested rectangles (also called tiles), Author Keywords there are multiple possible valid tiling arrangements. Treemap, heuristics, tiling, tessellation, metrics, aspect ratio, A common criterion for optimization is aspect ratio. Never- orientation agnostic, OAAR, FOAAR, orientation, offset theless, treemaps usually consist of multiple rectangles, so factor, offset quotient, information visualization, infoviz, the aspect ratios need be aggregated. macro-economic metaphor, eat the poor, eat the rich, subsidy, welfare The basic definition of aspect ratio (width divided by height) cannot be meaningfully aggregated. Given this, a definition of aspect ratio that does not differentiate height from width INTRODUCTION was suggested. This definition allows for meaningful aggre- Treemaps are one of multiple methods for visualization for gation, but only as long as there are no large differences in hierarchical data in the form of aggregating trees. The un- the data distribution, and the target aspect ratio is 1:1. derlying mechanism is assigning numeric values to the leaves Originally, a target aspect ratio of 1:1 was deemed to be ax- and then recursively calculating the value of the parent nodes iomatically ideal. Currently, perceptual studies have found an by aggregating values of the children all the way up to the aspect ratio of 1:1 to lead to the largest area estimation error. root. However, with any other target this definition of aspect ratio To represent these numeric values visually they are mapped cannot be meaningfully aggregated. to area. Traditionally, treemaps consist of nested rectangles This thesis suggests a correction that can be applied to the that represent each data element. In spite a fixed area acting current metric and would allow it to be meaningfully aggre- as constraint, there is an infinite number of valid rectangle gated even when there are large value differences in the data. configurations that would represent the data. Nevertheless, Furthermore, both the uncorrected and corrected metrics can there are differences in how desirable the configurations are be generalized for any target (i.e. targets other than 1:1). for the purpose of visualization. Another issue with current evaluation techniques is that algo- As originally proposed [11] treemaps would draw parallel rithm fitness is evaluated through Monte Carlo trials. In this lines to subdivide the root area either vertically or horizon- method, synthetic data is generated and then aggregated to tally and then switch direction for the next level of nesting. generate a single final result. However, tiling algorithm per- This approach is now known as the Dice and Slice tiling al- formance is dependant on data distribution, so a single aggre- gorithm (for an example see fig. 2). Dice and Slice has two gate result cannot generalize overall performance. The alter- desirable qualities beyond simplicity: ordering transparency native suggested in this thesis is visual cluster analysis, which and update stability [16]. should hold more general predictive power. However, Slice and Dice is not the most popular tiling algo- All of the above is put into practice with an experiment. In the rithm anymore (see fig.1). Presently, Squarify (see fig. 3) ap- experiment, a new family of tiling algorithms, based on crite- pears to be the de facto standard. Squarify is the default tiling ria derived from the results of the perceptual tests in literature, algorithm in the visualization library D3 [5] and the only is compared to the most popular tiling algorithm, Squarify. available algorithm in popular visualization software such as Excel, Tableau and Google . The results confirm that there are indeed vast but consistent value fluctuations for different normal distributions. At least Squarify was developed under the assumption that an aspect for a target aspect ratio of 1.5, the new proposed algorithms ratio of 1 (a square) is ideal for the purpose of visualization lit- eracy [6]. Nevertheless, this assumption was not made based on experimental data or any explicit perceptual principles.

1 0.340:1 0.518:1 5.28% 0.954:1 8.00% 8% 0.712:1 14.7% 11% 8 44.0% 11 0.672:1 0.604:1 0.547:1 0.499:1 1.39:1 8.84‰ 1.44:1 1.18% 1.06% 9.67‰ 81% 3.85% 2.02% 1.63:1 1.54:1 0.803:1 0.753:1 0.709:1 1.73% 8.13‰ 6.11‰ 5.75‰ 5.42‰ 1.87:1 1.67:1 2.99% 7.52‰ 1.38:1 0.784:1 0.746:1 1.88:1 5.12‰ 4.39‰ 4.19‰ 1.50% 1.80:1 1.45:1 1.55:1 0.354:1 6.99‰ 4.85‰ 3.67‰ 2.31:1 4.00‰ 81 2.14:1 2.42% 1.94:1 1.32% 1.53:1 1.63:1 6.53‰ 4.61‰ 3.83‰

3 Figure 3. A Squarify(r = 2 ) tiled treemap visualization of Zipf(k,s) 1 < k 30 k N s = 1 . Although the dataset is the same{ as fig. 2|, ≤ ∧ ∈ ∧ } Squarify Pivot Slice and Dice the aspect ratios are less extreme. However, the layout is unstable under data updates, ordering has been obfuscated and most aspect ratios differ 3 significantly from the target aspect ratio of 2 ).

Figure 1. Pie- visualization of proportion of tiling algorithms used Motivation by the first 100 Google images of rectangular treemaps (May 9, 2017, search term = "treemap") Given that the optimization criterion, an aspect ratio of 1,

5.4e-3:1 5.0e-3:1 4.6e-3:1 4.3e-3:1 4.0e-3:1 3.7e-3:1 3.4e-3:1 7.4e-3:1 6.8e-3:1 6.3e-3:1 5.8e-3:1 4.00‰ 3.83‰ 3.67‰ 9.7e-3:1 8.8e-3:1 8.1e-3:1 4.85‰ 4.61‰ 4.39‰ 4.19‰ 1.3e-2:1 1.2e-2:1 1.1e-2:1 5.75‰ 5.42‰ 5.12‰ 1.9e-2:1 1.7e-2:1 1.5e-2:1 7.52‰ 6.99‰ 6.53‰ 6.11‰ 2.6e-2:1 2.2e-2:1 9.67‰ 8.84‰ 8.13‰ 3.7e-2:1 3.0e-2:1 1.32% 1.18% 1.06% 4.6e-2:1 2.02% 1.73% 1.50% does not match the experimental evidence, as well as the ag- 6.0e-2:1 8.3e-2:1 2.99% 2.42% 0.127:1 5.28% 3.85% 0.236:1 8.00% gregate metrics not seeming representative of the actual dis- 14.7% tribution of aspect ratios there is a real need for alternative 0.712:1 quantitative evaluation metrics for treemap tiling algorithms. These new metrics should either be based on the experimental 44.0% results of previous literature or on mathematical reasoning. The contributions of this thesis are: 1. it provides a quantitative assessment of current metrics, 2. it suggests new alternative aggregate metrics, 3. it presents and evaluates new treemap tiling heuristics with novel optimization goals.

Research question Figure 2. A Slice and Dice tiled treemap visualization of Zipf(k,s) 1 < What quantitative metrics can be used to evaluate treemap k 30 k N s = 1 . It is evident that nodes are sorted{ in descending| size≤ order.∧ ∈ However,∧ legibility} decreases towards the right as aspect ratios tilings, and based on these metrics, how do Squarify and the go towards zero (a vertical line). Macro-Economic Metaphor algorithms compare in terms of node aspect ratios given a target aspect ratio? Actually, perceptual studies have revealed that area compar- isons for rectangles with an aspect ratio of 1 elicit the highest Abbreviations and definitions area judgment errors [13, 10]. Throughout this thesis, the following own abbreviations and concepts will be referred to. Furthermore, Squarify was proposed based on the orientation- agnostic definition of aspect ratio, which means that the target Metrics from the literature: aspect ratio is both itself and its multiplicative inverse. If the Aspect ratio intent is to specify a single target aspect ratio then this makes the non-orientation-agnostic definition of aspect ratio. it impossible unless it is 1. In practice, this also results in Width divided by height. treemaps with nodes of mixed orientation. Comparisons of rectangle with differing orientation, also elicit a considerable OAAR increase in area judgment error [13, 10]. orientation agnostic aspect ratio. Long side divided by short side. This is the definition typically used for com- Another dubious trait of Squarify is how it consistently results parison of tiling algorithms. in desirable average aspect ratios, even in instances when the algorithm yields individual rectangles that conspicuously do Own norms: not match the target aspect ratio. This suggests that the aggre- Scalar norm gate metrics used might not be representative. a norm that measures multiplicative distance from 1.

2 (a) Index (Viridis) Offset factor a norm that measures multiplicative distance from an arbi- trary target as a real number larger than one. First index Last index (0) (n–1) Offset quotient a norm that measures multiplicative distance from an arbi- (b) Linear (Cool) trary target as a real number less than one. Own metrics: Minimum Maximum Orientation A binary simplification of aspect ratio. Although orienta- (c) Logarithmic (Warm) tion can be found in the literature as a concept, this thesis proposes a formal definition for a quantitative metric.

FOAAR Minimum Maximum Fractional orientation-agnostic aspect ratio, the multiplica- tive inverse of OAAR. Due to a bounded range ([0,1]) and Figure 4. Color schemes used in this thesis to represent scale types. pseudo-logistic growth, it is assumed to be better suited for Where Viridis, Cool and Warm are built-in color interpolator curves in the aggregation. D3 v4 library [4]. Offset Ratio of aspect ratio A modification of OAAR to account for an arbitrary frame Cleveland and McGill [8] of reference. This study precedes the invention of treemaps, so it does not directly concern treemaps, unlike the other two perceptual Offset Quotient of aspect ratio studies. However, those two other studies expand upon the A modification of FOAAR to account for an arbitrary theoretical and empirical basis established by Cleveland and frame of reference. McGill [8]. Own concepts: Perfect Solution Type 2 A treemap tiling is said to be perfect if all the rectangle nodes have an aspect ratio equal to a specified target. Type 4 MEM Type 5 Acronym for Macro Economic Metaphor. 1.0 1.5 2.0 2.5 3.0 Log Error The Macro Economic Metaphor The metaphorical allegory created to explain and illustrate the functioning of the MEM heuristics and algorithms. Figure 5. Area judgment error for different elementary perceptual tasks. This chart is a summary of the results of the perceptual study by Cleve- land and McGill [8], based on a portion of figure 16 in that paper. The red Color Schemes rectangles are the ones being compared. Throughout the course of this thesis three different types of scales are used: index, linear and logarithmic scales (fig. 4). Cleveland and McGill [8] begin their paper with criticism of Each one has been assigned a different color transfer function. information visualization. The authors argue that graph de- The transfer functions are different so that the type of scale is sign remains largely unscientific since it relies on tradition, known in those instances where scales numerical values consensus and rule of thumb rather than theory or experimen- to color rather than to Cartesian coordinates. tal results. Hence, they define a theoretical basis and perform perceptual tests. The theoretical part proposes elementary RELATED WORK perceptual tasks, processes in which the user attempts to de- In this section three main topics will be discussed: rive the quantitative attributes from the optical properties to 1. the perceptual studies on which this paper is based, which they were mapped. While the paper is not exhaustive in nature, it does explore 2. aspect ratio and orientation as evaluation metrics multiple types of graphs and optical properties. Among those, 3. previous art in the form of treemap tiling algorithms with visualization literacy for vertical length in stacked staple bar an aspect ratio target. charts. Cleveland defines three possible types of comparison for rect- Perceptual studies angles in stacked bar charts. There are characterized by their The MEM algorithms have a list of goals(see 3.8.1). These relative position (x,y) to one another in the 2D space of the goals are a direct interpretation of previous research. Specif- graph. These types are for comparisons between two rectan- ically, the experimental results of three visualization literacy gles: perceptual studies: Cleveland and McGill [8], Heer and Bo- stock [10] and Kong et al. [13] 1. with the same y value (Type 2),

3 2. with different x and y values (Type 4), 2⁄3 : 2⁄3 3. with the same x value (Type 5). 1:1 3⁄2 : 3⁄2 Cleveland and McGill conducted a within subjects perceptual 2⁄3 :1 test of the types (n=51) and found that type 2 comparisons elicit the least error, type 4 elicit slightly more error and type Aspect Ratio 2⁄3 : 3⁄2 5 elicit the largest error (see fig. 5). 1:3⁄2 2.0 2.25 2.5 2.75 3.0 Heer and Bostock [10] Log Error Heer and Bostock sought to reproduce and expand upon the perceptual study by Cleveland and McGill [8]. Rather than Figure 7. Area judgment-error for different elementary perceptual tasks. using a traditional pool of test subjects, a large number of This chart is a summary of the results of a perceptual experiments by Turkers were employed. Turkers are online distance workers Heer and Bostock [10] based on a portion of figure 5 in that paper. who perform HITs (Human Intelligence Tasks) over the Inter- net for monetary compensation [1]. The experiment showed that there is a statistically significant Heer and Bostock extend the study by Cleveland and McGill correlation between aspect ratio and area judgment error (p < with additional types of elementary perceptual tasks [10]. 0.05). Furthermore, area comparisons where both rectangles Two of these perceptual tasks are relevant to this thesis. These had a 1:1 area elicited the most error (see fig. 7). are area comparisons between two rectangles: Heer and Bostock note, however, that Squarify does not seem 1. with horizontally aligned centers (Type 8), to produce rectangles of the requested aspect ratio and hy- pothesize that this incapability might coincidentally favor the 2. in Squarify tiled treemaps (Type 9). algorithm. The results for this experiment can be seen on figure 6. As it Kong et al. [13] can be observed, Heer and Bostock [10] the resulting values Like, Heer and Bostock [10] this study also employed Turkers are consistent with those by Cleveland and McGill [8]. While for its perceptual experiments. However, rather than tackle the error was lower for all three types (2, 4 and 5), and the elementary perceptual tasks once more, this study focuses differences between the types were less pronounced as well, on the effects of luminance, aspect ratios and orientation on the relative distribution of the types in terms of most and least treemap visualizations. error remains unchanged. Both of the new perceptual tasks (types 8 and 9) resulted in more error than the first three types (2, 4 and 5), with rectangles in Squarify tiled treemaps (type 3⁄2 : 9⁄2 9) eliciting the most error. 1:3⁄2 3⁄2 : 3⁄2

Type 2 OAAR 1:9⁄2 1:1 Type 4 9⁄2 : 9⁄2 Type 5 2.75 3.0 3.25 3.5 Type 8 Log Error

Type 9 Figure 8. Area judgment-error for different orientation-agnostic aspect ratios (OAAR). This chart is a summary of the results of the perceptual 1.0 1.5 2.0 2.5 3.0 study by Kong et al. [13] based on figure 7 in that paper. Log Error While no significant correlation between luminance area judg- Figure 6. Area judgment-error for different rectangle aspect ratios. This ment error was found, aspect ratio was found to have a statis- chart is a summary of the results of the perceptual study by Heer and tically significant effect on area judgment error (p < 0.001). Bostock [10] based on a portion of figure 4 in that paper. Not only that, but the results also support the findings Heer Additionally, Heer and Bostock mention that aspect ratio is and Bostock [10], that comparisons among rectangles with among the parameters believed to have perceptual effects on aspect ratio 1 elicit the most area judgment error (fig. 8). Fur- area judgments. While they are aware that Squarify mini- thermore, Kong et al. also find that extreme aspect ratios yield mizes deviation from a 1:1 ratio, they find no reason to tacitly comparable amounts of area judgment error. assume that a 1:1 ratio would be perceptually optimal. In the case of orientation the correlation is not as clear (fig. 9). For the above reason, Heer and Bostock conducted an addi- There is a statistically significant interaction between orienta- tional perceptual experiment. In this experiment, the subjects tion, aspect ratio and area judgment error (p < 0.001), but estimate the areas two of rectangles with different aspect ra- orientation alone does not seem to be statistically correlated tios. (p < 0.414) to area judgment error. However, the authors do

4 Orientation OAAR extreme aspect ratios and aspect ratio 1 exhibit the most judg- ment error, so the ideal ratio should be somewhere in between. 3⁄2 : 9⁄2 3 Same Both Heer and Bostock [10] and Kong et al. [13] suggest 2 3⁄2 : 3⁄2 as an optimization target. Nevertheless, it should be pointed 9⁄2 : 9⁄2 2 out that the experiments have only evaluated aspect ratios 9 , 3⁄2 : 9⁄2 2 3 9 3 , 1, 2 2 and that the ideal optimization target, if there is one, Different 3⁄2 : 3⁄2 9 could be anywhere between 1 and 2 . Simply put: rectangles 9⁄2 : 9⁄2 that are wider than taller but not overly so. 2.75 3.0 2.25 3.5 Log Error

Figure 9. Area judgment-error by orientation-agnostic aspect ra- tios(OAAR) and equal or differing orientations. This chart is a summary of the results of the perceptual study by Kong et al. [13] based on figure 6 in that paper. note that the difference is pronounced for the extreme aspect 9 3 2 ratios ( 2 ). So they hypothesize that aspect ratios of 2 and 3 might be too close to squares to exhibit any significant area estimation effects due to orientation. From the results of the experiments, Kong et al. concludes that treemap tiling algorithms should avoid extreme aspect 3 ratios and optimize for a 2 aspect ratio. The authors hypothesize then that Squarify benefits from its failure to Squarify all nodes and actually achieve an aspect ratio of 1. They go on to suggest, however, that an algorithm 3 that optimizes for an aspect ratio of 2 should perform better than Squarify. For future research they suggest creating such and algorithm and comparing it to Squarify.

Aspect Ratio The authors of many of the current algorithms claim that they produce "high quality" treemaps [7]. Nonetheless, what crite- Figure 10. Shepard’s tables, an optical illusion wherein a rotation makes ria dictate high quality for a treemap varies by author. For the the same parallelogram appear to have different shape and area. purpose of this thesis it will be aspect ratio. Squarify, Strip and the MEM algorithms all take in a desired aspect ratio as a parameter that the algorithm will attempt to Orientation achieve for all rectangles. If the entire area can be divided in Orientation is a binary simplification of aspect ratio. A rect- such rectangles while maintaining area constraints then there angle is horizontal if it has a greater width than height, and is a perfect solution. However, finding a perfect solution is conversely, vertical if its height is greater than its width. NP hard for an arbitrary set of values [6, 3, 9]. Furthermore, a perfect solution might not even be mathematically possi- The reason this metric is useful is mainly due to labeling pur- ble depending on node values and the aspect ratio specified poses, as a horizontal rectangle will maximize line width for [2]. Approximations are hence necessary when no perfect so- a horizontally written text. lution exists, and useful as a heuristic to reduce algorithmic complexity otherwise. Beyond that, it is not entirely clear to what extent it might have or not an effect on area judgment error depending on Due to the above, a meaningful aspect ratio aggregate could aspect ratio [13]. Nevertheless, for rectangles with a large be used as a measurement of fitness for an approximation. enough OAAR, it might have an effect. Not only based on Where a treemap would obtain a perfect aspect ratio aggre- the results of Kong et al. [13], but also due to a known optical gate if and only if all its rectangles have the target aspect ratio illusion: Shepard’s (see fig. 10 )[18]. (i.e. a perfect solution). However, in Shepard’s Table, only the orientation changes Additionally, aspect ratio has been shown to have an statisti- while OAAR and area remain unchanged. Treemap nodes, cally significant relationship to area judgments error. Certain however, need not have these constraints. Hence, the area aspect ratios seem to perform better than others [10, 13]. As judgment error can be expected to be larger than the one shown by Heer and Bostock [10] and Kong et al. [13] both elicited by the images used to illustrate the optical illusion.

5 Tiling algorithms Squarified In the literature search, three tiling algorithms that take in a Although spike phrasing (an alternation rows and columns of desired aspect ratio were found: Squarify, Strip and Squarify node [2]) predates the paper by Bruls et al. [6], the author Plus. was the first to formalize the theory and implementation for the algorithm. Squarify is the algorithm on which the MEM-algorithms are based, Strip is a version of Eat The Poor that places the nodes Squarify is a greedy algorithm that subdivides the root into into rows rather than columns, and Squarify Plus could be a nodes and columns. It assumes that if every column removed MEM algortihm with an alternate heuristic to Squishing. from the remaining area has the best possible aspect ratio, the final layout will also have the best possible aspect ratio. This is demonstrably not true, but as heuristic it yields outstanding Algorithm 1 Squarify results. Root has position, height and width Require: However, there existed no definition of what an optimal as- Root’s children have position, height and width Ensure: pect ratio would be, so Bruls et al. axiomatically decided that an aspect ratio of 1 was ideal [6].The author then provides 1: SQUARIFY(root,ratio = 1) function an orientation-agnostic definition of aspect ratio (OAAR) [6]. 2: root has no children root if then return While these two decisions might seem unrelated, together 3: remaningWidth width of root ← they allow for meaningful aggregation of aspect ratios as ex- 4: remaningHeight height of root plained in sub-subsection 3.5.3 (Offset factor). 5: while any children← left do 6: queue new list of nodes Based on this theoretical groundwork, Squarify can be written 7: repeat← as pseudocode as is shown on Algorithm 1. For examples of 8: take a node and add it to queue squarified treemaps see figure 11. 9: worstOAAR calculate worst OAAR ← in queue in relation to ratio Strip 10: until meanOAAR ratio or no children left As formulated by Bederson et al. [3], Strip is a modified ver- ≥ 11: rollback last node added to queue sion of Squarify that is not allowed to switch to columns (i.e. 12: if remaningHeight > remaningWidth then it only dices and never slices). 13: Dice column 14: remove row height from remainingHeight It is a strange design decision nonetheless for multiple rea- 15: else sons. In terms of labeling, font sized are usually specified 16: Slice column in terms of height but not width; so having a variable width 17: remove column width from remainingWidth makes labeling more difficult. In regards to familiarity, a hori- zontal reading directions is almost universal. Conversely, top 18: root return to bottom is only prevalent among certain East Asian lan- guages that can be written either vertically or horizontally (e.g. Chinese, Korean and Japanese). 0.728:1 0.565:1 1.50:1 1.50:1 0.538:1 0.538:1 0.538:1 0.538:1 0.538:1 0.999:1 5.50% 4.00% 4.00% 4.00% 4.00% 4.00% In terms of performance, there is a consensus that this algo- 0.966:1 9.70% 7.08% 4.00% 4.00% 1.50:1 1.50:1 rithm results in more stable layouts with high legibility but 26.9% 4.00% 4.00% 0.734:1 0.734:1 0.734:1 0.762:1 0.671:1 0.598:1 0.538:1 1.22:1 not as "desirable"(OAAR(R) 1) aspect ratios as Squarify 1.14:1 2.17% 1.96% 4.00% 4.00% 4.00% 2.76% 2.43% 1.50:1 1.50:1 4.00% → 4.45% 4.00% 4.00% [3, 9, 19]. However, in regards to the latter, let it be con- 0.496:1 0.466:1 0.439:1 1.22:1 1.09:1 9.95‰ 1.37:1 1.12% 1.06% 1.50:1 1.50:1 0.412:1 0.412:1 1.36:1 1.78% 1.38% 4.00% 1.66:1 4.00% 4.00% sidered that there is a very real possibility that Strip has suf- 3.72% 4.00% 4.00% 1.77:1 1.49:1 1.18:1 4.00% 1.28% 1.32:1 1.19:1 1.22:1 fered from all biases mentioned in subsection 3.6 (Problems 1.60:1 1.62% 9.41‰ 8.47‰ 1.50:1 1.50:1 1.66:1 1.63:1 1.26:1 1.39:1 1.25:1 4.00% 14.7% 3.17% 1.49% 1.20% 8.92‰ 8.07‰ 4.00% 4.00% 4.00% with arithmetic mean of aspect ratio) . Furthermore, it is stan- dard procedure to sort Squarified treemap nodes by value in (a) Zipf (b) Uniform order to improve aspect ratios [19]; however, when compar- 0.573:1 0.416:1 0.416:1 1.25:1 0.616:1 0.596:1 0.575:1 0.552:1 9.68% 9.68% 1.39:1 5.03% 4.86% 4.69% 4.51% ing Squarify to Strip, the nodes were only sorted for Squar- 1.91:1 13.3% 5.62% 6.13% ify; which can be confirmed by the illustrations of the authors 15.6% 1.41:1 1.28:1 1.25:1 0.660:1 0.617:1 0.570:1 [3, 9, 17]. The above introduces considerable bias in favor of 6.01% 5.48% 3.68% 3.44% 3.18% 1.91:1 4.31% Squarify and against Strip in the comparisons in the literature 1.32:1 0.812:1 0.812:1 1.44:1 15.6% 2.15:1 1.31:1 0.804:1 0.677:1 3.16% 3.16% 5.89% 5.34% 1.20:1 1.93% so far. 5.99% 4.11% 2.90% 2.28%

2.25:1 0.595:1 0.595:1 0.749:1 0.749:1 5.43‰ 5.43‰ 1.48:1 1.36:1 2.15:1 1.42% 1.42% 1.38:1 1.34:1 0.949:1 1.56:1 1.53% 1.08%

0.445:1 0.445:1 0.993:1 0.993:1 493ppm 493ppm 5.18% 3.90% 2.61% 3.03:1 1.77‰ 1.77‰ 5.76% 0.267:1 0.267:1 13.3% 5.99% 1.30:1 1.30:1 23.6ppm 23.6ppm 117ppm 117ppm 5.62‰

3.58:1 3.58:1 4.06ppm 4.06ppm Squarified Plus (c) Normal (d) Log-Normal Proposed by Cesarano et al., SquarifyPlus is a modified ver- sion of squarify [7]. Figure 11. Squarify, examples of algorithm results for different data distri- 3 butions. The aspect ratios are conspicuously off-target (target is 2 ) and The main difference with squarify is that this algorithm will almost half of the nodes are vertically oriented. Please notice that this "invert rows" (i.e. turns rows into columns). It does this when- algorithm does not yield a perfect solution for an uniform distribution. ever it would result in a lower worst OAAR for the nodes in the column than the row [7].

6 In practice, this seems to results in tendency for node columns For a of this function see figure 12. rather than rows. In the experiment by Cesarano et al., Squarified Plus rendered better aspect ratios than Squarify [7].

BACKGROUND In this section, the theory behind the different experiments will be presented and motivated. )

y 10

Specified problem definition ∆ ,

Treemaps represent hierarchical data as nodes. Normally, x ∆ each datum will have a corresponding node. This is a bijec- ( tive mapping. Through an accessor function, it can be spec- AR 4 ified what specific attribute of leaf nodes is to be quantified; this is an injective mapping to R. Leaf nodes are aggregated 0 1 2 to calculate the values of the parents and, since the root is par- 2 ent to all, the root will have a value equivalent to the sum of 3 ∆y 4 all leaves. ∆x The root node will then be assigned an arbitrary position, height and width. Based on these arbitrary values, the tiling Figure 12. Aspect ratio as a function of ∆x and ∆y. Although the most common notation ∆x : ∆y uses a colon(:) to express aspect ratio as a algorithm calculates position height and width for all descen- proportion, the function can be evaluated and expressed as a single real dants down to the leaves. These properties must be calculated positive number. rather than arbitrarily assigned because the amount of area as- However, the general definition of aspect ratio does not apply signed to each node (height width) must be proportional its · to treemap nodes. Not all points in the 3d surface are valid value. configurations. The only valid width and height combinations The above is by itself not a computationally complex task. are those that preserve area. This is because, in a treemap, a However, since multiple possible solutions exist, further op- node’s numerical value (v) is mapped to the optical property timization criteria can be specified. For this thesis, it will be of area via: that an unambiguous target aspect ratio can be specified, so v = a∆x∆y, that all rectangles in the treemap have the target aspect ratio. Such a solution will be called a perfect solution to the prob- where a is an area proportionality constant. lem. Consequently, width(∆x) and height(∆y) are not independent Due to geometrical constraints, such as the rectangular shape variables. In fact, they are inversely proportional. Herein, of the nodes, a perfect solution will not always be possible that either one can be expressed in terms of the other. By arbi- [2]. trarily selecting ∆y as the free variable, aspect ratio can then be rewritten as the multiplicative inverse of a linear function Besides, a simpler variant of the problem, minimizing the as- w(∆y): pect ratios of the nodes, is claimed by many authors to be NP hard [6, 3, 9]. 1 For the above two reasons, a heuristic is necessary. AR(R)= . w(∆y) Aspect ratio This constrain will result in a one-argument parametric curve Definition with a domain of possible widths and the corresponding as- Let aspect ratio(AR) be: pect ratios (see fig. 13). width(r) x x AR(R)= = 1 − 0 Scalar Norm height(r) y y 1 − 0 Due to the asymptotic nature of the aspect ratio function and to the fact that all previous researchers have decided to use Where R = x ,y ,x ,y is a rectangle with (x ,y ) as its top { 0 0 1 1} 0 0 Cartesian rather than hyperbolic coordinates for nondescript left corner and (x1,y1) as its bottom right corner. reasons, let me suggest a definition for a norm that measures A single fixed point definition for rectangles (R = multiplicative distance: x,y,∆x,∆y ) is also a viable alternative as long as width (∆x) { } Definition and height (∆y) values are provided instead of the opposing For x R, let: corner. In that case, the aspect ratio function takes in a mini- ∈ 1 mum of two free variables instead of four: x , if x < 1 ∆x x 1 = 1, if x = 1 . AR(∆x,∆y)= ∥ ∥ ⎧ ∆y ⎨x, if x > 1 ⎩ 7 AR(R) similar rectangles will have the same OAAR regardless of ori- w(∆y) entation. However, the above also means that OAAR is not a continu- ous function and can more formally be defined as:

AR(R), if AR(R) > 1 OAAR(R)=⎧ 1, if AR(R)=1 . 1 ⎨⎪ AR(R) , if AR(R) < 1 1 w(∆y) ⎩⎪ AR(R) ∆y The above definition of the metric is equivalent to 1, the scalar norm of aspect ratio. Furthermore, yet another∥ pop-∥ ular equivalent definition is the one used by Bruls et al. [6]: Figure 13. The one dimensional form of aspect ratio (blue), alongside the linear function of height (red). Bear in mind that any possible aspect ratio 1 can be written in the form ∆y . 1 ∆x OAAR(R)=max AR(R) , . AR(R) % & This norm yields a more representative measurement of dis- tance along the function curve of aspect ratio from the Carte- In terms of treemap nodes, with a fixed area and inversely sian coordinate. proportional height and width, this means that the function consists of two separate parametric curves with different free Application variables. Let R1 and R2 be rectangles and AR(R1) ! AR(R2). Then:

AR(R1) 1 = AR(R2) 1 1 1 ∥ ∥ ∥ ∥ and , If and only if: w(∆y) h(∆x) width(R1)=c height(R2) and height(R1)=c width(R2). where h(∆x) is the corresponding function to linear function · · to w(∆y). With c R being an arbitrary proportionality constant and the ∈ OAAR switches between these curves at 1,1, giving the im- above being a corollary of the definition of aspect ratio. pression of functional symmetry, however this also results in mathematical singularities on both ends (see fig. 14) and a OAAR(R) or ∆x range of [1,∞). w(∆y) f (x)= 1 Let it be clear that when authors in the literature compare h(∆y) tiling algorithms, what they are normally using is OAAR h( x) ∆ and not the traditional definition of aspect ratio. The reason OAAR is used is matemathical. With an optimization crite- rion of AR(R)=1, the same value as the lower bound of OAAR, an arithmetic mean unweighted OAAR of 1 would then indicate a perfect solution. Interpretation f (y)= 1 w(∆x) OAAR is the ratio between the long and short side of the rect- OAAR(R) or ∆y angle.

Figure 14. Orientation agnostic aspect ratio (OAAR). The function fakes long = OAAR short. symmetry by switching function and axis(free-variable) at (1,1). ·

Orientation agnostic aspect ratio (OAAR) Own metrics There is an alternate definition for aspect ratio that does not This paper defines three new aggregate metrics. The next sec- take into account the orientation of the rectangle. tion exposes the problems these metrics aim to address. How they are actually addressed is explained in the subsection after long side OAAR(R)= . that. short side Fractional Orientation agnostic aspect ratio (FOAAR) This definition focuses on the larger than 1 proportionality Let me suggest an alternate orientation-agnostic definition for factor between sides without taking into account whether it aspect ratio (see fig.16). Unlike OAAR, that has mathemati- is multiplying height or width. This has as an advantage that cal singularities on both ends and a range of [1,∞) (see fig.15),

8 Figure 15. Superposition of two plots eliciting why FOAAR has a un- Figure 17. Superposition of two plots eliciting why FOAAR has a bounded bounded range of [1,∞). range of [0,1].

FOAAR(R) or ∆x However, this metric can be multiplicative inverted in order to obtain the ratio between the long and short side of the rect- 1 w(∆y) f (y)= h(∆x) angle. h(∆x)

1 long = FOAAR− short. · The inversion, nevertheless, should only be performed once and after aggregation. 1 Orientation f (x)= w(∆y) Although commonly mentioned in previous literature [13, 2], FOAAR(R) or ∆y it has not been in the form of a quantitative metric. So, let orientation be defined as: Figure 16. The fractional orientation agnostic aspect ratio function, which not only fakes function symmetry but also exhibits bounded range of [0,1] and pseudo-logistic behavior. 1 if AR(R) 1 orientation(R)= ≥ . 0 if AR(R) < 1 ' FOAAR, has no mathematical singularities and a bounded range of [0,1] (see fig.17). This is a convenient metric for the mean aggregate since it is bounded ([0,1]). The mean is also representative and in- Furthermore, this metric exhibits an almost logistic behavior, tuitive, as the resulting number will be the percentage of the which reduces the effects of extreme aspect ratios on aggre- rectangles that are horizontal (viz. wider than taller). gates. Horizontal rectangles and squares were assigned the value of This definition is as simple as switching the conditions for 1 because as shown by Heer and Bostock [10] but most of all OAAR: Kong et al. [13], this orientation results in the smallest area judgement error. AR(R), if AR(R) < 1 FOAAR(R)= 1, if AR(R)=1 . Offset factor ⎧ If the optimization criterion is that the value should be as ⎪ 1 , if AR(R) > 1 ⎨ AR(R) close as possible to 1, OAAR would be able to function as an unambiguous optimization metric as it is pseudo-symmetric ⎩⎪ 1 and it’s lower bound is 1 as well. Hence there is a bijective Which is equivalent to AR(R)− 1, the multiplicative inverse of the scalar norm of aspect∥ ratio.∥ mapping between a perfect input and a perfect output:

Interpretation OAAR(x)=1 x = 1. FOAAR is the ratio between the lengths of the short and long ⇔ sides of the rectangle. Consequently, a perfect value is indicative of a perfect solu- tion, even for aggregation. short = FOAAR long. Furthermore, OAAR(x)=offset where: ·

9 Problems with arithmetic mean of aspect ratio x x offset = target = target. Since there are multiple nodes in a treemap the naive assump- · ∨ offset tion might be that an arithmetic mean of their values would be an adequate aggregate metric. Below there is a list of reasons Which is a meaningful value that represent the offset from against this practice. the target. It is the factor by which either the dividend or the divisor (in this case in aspect ratio) were too large. Hyperbolic coordinates In physics it is common to encounter variables with a relation However, for any target value other than 1 none of the above in the form of: applies. Nevertheless, OAAR or more specifically scalar norm, can be generalized to exhibit this properties for an arbi- trary input value. The resulting norm has been named offset k = x y. factor: · In these cases, hyperbolic coordinates are used to account for t the asymptotic nature of the function. x , if x < t x t = 1, if x = t , This is the relationship between width, height and area in a × ⎧ ∥ ∥ x rectangle: ⎨ t , if x > t where t is the target. ⎩ When used in tests, it will be referred to as offset factor of Area = width height. aspect ratio. · Since the rectangle area follows the same form, one would Interpretation expect hyperbolic coordinates to at least have been consid- Offset factor of aspect ratio is the scalar norm of the ratio ered in the literature. Nevertheless, no papers were found between the target aspect ratio and the aspect ratio. on the subject of treemap tiling algorithms that even mention them. This paper will continue to use Cartesian coordinates, AR(R)=k target, as otherwise, it would be difficult to compare the results and · methodology with the previous literature. However, it will be where: necessary to address the complications that arise from treat- ing a hyperbolic path as if it were parallel to the Cartesian axis. R = k ∥ ∥/target ∥ ∥1 Non-linear and asymmetric Offset quotient The fundamental issue with arithmetic mean of aspect ratio is Offset quotient the norm obtained by flipping the conditions that it measures central tendency alongside the Cartesian axis. of offset factor: Nevertheless, aspect ratio, a quotient, is multiplicative rather than additive in nature. Hence, its origin is one, the multi- t plicative identity, and not zero, the additive identity. Conse- x , if x > t quently, the inverse values will not be lower than zero, but x = 1, if x = t , lower than one. Therefore, aspect ratio will be unable to ever /t ⎧ ∥ ∥ x reach the value of zero and is only defined on the first quad- ⎨ t , if x < t rant. Another way of describing this is that the aspect ratio where t is the target. ⎩ function exhibits axial rectangular-asymptotes (see fig. 13). Offset quotient of aspect ratio exhibits the same desirable Nevertheless, what quantifies the proportion between rectan- functional properties for aggregation as FOAAR, namely no gle sides is the distance from the multiplicative identity along mathematical singularities and a bounded range of [0,1]. the curve and not the numeric value of the function (parallel Also as FOAAR, after aggregation, this metric should be mul- to a Cartesian axis). Hence, averaging a sample of the values, tiplicative inverted in order to obtain a more intuitive result. does not yield a value indicative of the sample. Interpretation For the above reason, arithmetic mean of aspect ratio behaves Offset quotient of aspect ratio is the scalar norm of the ratio asymmetrically depending on orientation. For instance, the between the target aspect ratio and the aspect ratio. proportions of a rectangle with an aspect ratio close to zero (a vertical line-like rectangle) are not more extreme than those of a rectangle with an aspect ratio close to infinity (a horizon- AR(R)=k target tal line-like rectangle). Nonetheless, while the former has a · bounded range of [0,1], the latter is in the interval of [1,∞) where and may hence drastically skew the aggregate. A corollary of the above is that a 90 degrees rotation can dra- R = k matically change the average aspect ratio of a treemap. ∥ ∥/target ∥ ∥1

10 For the above reasons usage of OAAR is particularly com- any ratio other than the parameter are a measure of human mon in the literature, as it aligns both asymptotes with the error rather than of algorithmic behavior. Cartesian range axis. However, this has not stopped authors from comparing Squar- Skewed by outliers ify to algorithms that do not take in a target aspect ratio as a Arithmetic mean is skewed by outliers. An element with a parameter [6, 16, 9]. These algorithms do not have a unique large enough value will be the dominating term for the re- and obvious target aspect ratio. Although average aspect ra- sulting value. This is an issue because of orientation. As tios can still be computed, there is no common frame of ref- mentioned above the rate and direction of growth depends on erence for such a comparison. Therefore, any conclusions orientaion. Hence, more than rectangle aspect ratio, what will derived from these numeric values are as baseless as the as- be the deciding factor for the metric is the configuration of the sumption that the parameter-less algorithm should result in layout in terms of orientation. Hence, in cases where there is the target aspect ratio parameter supplied to Squarify. Or, al- mixed rectangle orientation the aggregate will be anywhere ternatively, if aiming for the edge case mentioned above, that between the extreme value and zero, and is not ensured to be an aspect ratio of 1 is ideal. representative. In conclusion, the problem with unweighted arithmetic mean of aspect ratio, is that it reflects orientation Relevance to visualization and number of nodes, but not actually the widths and height There is a final impediment that alone justifies avoiding arith- of the rectangles. metic mean as an aspect ratio aggregate for the purpose of visualization. Namely, that it needs not reflect visual appear- Also, small nodes can have extreme enough aspect ratios as ance. to dominate over any other term. This is because, in visualization, there must always be mini- Handling of multi-modal distributions mum resolution, let it be that of a display, the printer, or in In multi-modal distributions arithmetic mean does not need the most extreme cases, the human eye. Any rectangles with be indicative of the underlying density function. width or height underneath the minimum resolution will be invisible. Additionally, rectangles with dimensions close to Let it be noted that in the case of treemap tiling algorithms, a these resolution boundaries will be illegible. bimodal distribution is not a contrived edge case. For Squar- ify, it is the exact opposite: it is intended behavior. By design, One of the paradoxes of aggregation of aspect ratio is that the the algorithm alternates between columns of nodes that might lowest value nodes might potentially have the most extreme overshoot the specified aspect ratio and rows that will under- values. This is because they are less constrained by the di- shoot it. mensions of the parent. This poses an issue, as in the context of information visualization invisible sub-pixel nodes are ir- Hence, Squarify tiled treemaps can be expected to have an relevant. average aspect ratio that is not representative of aspect ratios of its nodes. For an empirical demonstration see Experiment 2 on this paper. Solutions to problems with arithmetic mean of aspect ra- tio Relative frame of reference The following are the solution that will be attempted in order Analysis of average aspect ratio is often seen as an optimiza- to make aggregation of aspect ratio more representative of the tion problem where a minimal aspect ratio is the goal. aspect ratios of the treemap rectangle nodes. However, the above is not only an oversimplification, it is actually an specific edge case. A minimal aspect ratio is only Orientation agnosticism a valid optimization criterion when the target aspect ratio is The most basic approach to solve the issue of the function 1 and the metric is not aspect ratio but OAAR (Since OAAR curve not being aligned with the Cartesian axis, which is the has a lower bound of 1). For any other target aspect ratio, main source non-representation in terms of aggregation, is the mapping will be injective. Hence, a perfect value will no to use an orientation agnostic form of aspect ratio. While longer entail a perfect solution. it is normally mathematically unconventional to switch free variable amid a function, this approach has been widely used As to being an oversimplification: is an average aspect ratio before in the literature [6, 16, 9, 17, 12]. of 20 an inherently undesirable result? Not if the target as- pect ratio is 20; in that case, it is intended behavior. On the Orientation as a separate metric same line of thought, missing the target by 1 is then far less There is a obvious downside to using orientation agnostic met- 3 significant than if the target had been 2 . Once AR(R)=1 is rics for treemap assessment: that the orientation information no longer the optimization criterion, overshooting and under- is lost. Nevertheless, orientation is also reason for which the shooting the target will have different effects on OAAR. function is not aligned to a single Cartesian axis but rectan- gular asymptotic instead. Hence, it remains undesirable to Evidently, in the case of an algorithm that takes in aspect ra- reflect orientation via the metric. tio as a parameter, the only valid frame of reference is the parameter itself. This is because, since these algorithms are Nevertheless, all this can be addressed by separately evalu- configurable, they can be predisposed to result in arbitrary as- ating rectangles not only in terms of aspect ratio but also of pect ratios (even extreme ones). Hence, comparisons against orientation. Not only is this not difficult to do but the resulting

11 aggregate is clearly representative and intuitive. This is why amount of area judgement error. However, since not many an orientation quantitative metric is proposed in this thesis. aspect ratios were tried in Heer and Bostock [10] and Kong et al. [13], the optimal aspect ratio could be anywhere in Bounded function between 1 and 4.5. A bounded function should solve this problem. This is be- cause if the function has asymptotes parallel to the free vari- Avoid extreme aspect ratios able, an individual node value will never surpass the asymp- Extreme aspect ratios have been shown to result in larger tote. Hence there is a limit for how much each individual area judgement errors. They also present challenges for node can skew the aggregate. labeling and interaction. This is why FOAAR and offset quotient of aspect ratio are Top to bottom, left to right reading direction suggested. This requirement is for the purpose of ordering. It was Weighted mean arbitrarily decided that it was more intuitive if the algo- Weighting the mean by the value of the nodes should also rithm matches the standard reading direction of columns solve the aggregate skew, as only the lowest value nodes can and rows of text. have the most extreme values. Furthermore, beyond the fact Homogeneous orientation of sub-pixel nodes are irrelevant, it could also be claimed that Differing orientation is suspected to increase area judge- small enough nodes might not be legible or of representative ment error for rectangles with large aspect ratios [13], fur- importance; which a bounded function does not address. thermore it poses a challenge in terms of labeling. For this This is why, in the first two experiments in this paper, reason as many rectangles as possible should have the same weighted and horizontal mean will be evaluated and com- orientation. pared. While these goals are described in prose they do pose require- Frame of reference ments in terms of metrics. Namely, that the aggregate metric Offset ratio and offset quotients have been suggested as met- of orientation should have a value of 1 (viz. 100% of the rect- rics. When those metrics are used, a value of 1 will always angles are then horizontal) and that the aspect ratio is close to indicate a perfect solution regardless of target aspect ratio. the target aspect ratio.

Own heuristics and algorithms Algorithm 2 The basis of all MEM algorithms With the findings by of the perceptual studies [8, 10, 13] in Require: Root has position, height and width mind, a set of goals for a tiling algorithm was specified. An al- Ensure: Root’s children have position, height and width gorithm that aims at fulfilling these goals was designed. Since the algorithm alone, a modified version of Squarify, was not 1: function DISTRIBUTEWIDTH( always enough to fulfill the goals, two heuristics resulting in root, 3 four algorithm are suggested in this thesis. ratio = 2 , direction = These heuristics and algorithms bear descriptive names that ) → are meant to explain their underlying mechanism of action. 2: root has no children root Based on the common theme shared by these names, they are if then return 3: remaningWidth width of root collectively grouped and referred to as the MEM heuristics 4: any remainingWidth← still left and algorithms. while do 5: column new list of nodes ← Goals 6: repeat These were the goals posed for the algorithm and their moti- 7: take a node and add it to column vation: 8: meanOAAR average OAAR of column ← nodes Column based 9: until meanOAAR ratio or no children left Rectangle comparisons on Squarify treemaps show a larger 10: rollback last node≥ added to column area judgement error than any perceptual tasks on stacked 11: Slice column bar charts. Hence, make the treemap be divided into 12: remove column width from remaining width columns only so that it resembles a stacked bar chart as 13: return root much as possible.

Horizontally oriented rectangles Implementation A horizontal orientation presented a lower area judgement To fulfill the above requirements algorithm 2 was created. It error in the perceptual tests by Heer and Bostock [10]. This is a greedy algorithm that serves as the basis for all MEM orientation also convenient for labeling due to the horizon- algorithms. tal reading direction of most languages. While the above algorithm might be able to fulfill all goals on Configurable target aspect ratio some specific instances, it is not enough to fulfill them most 3 An aspect ratio of 2 has been shown to result in the least of the time. The issue is the variability in aspect ratio, which

12 results in failure to achieve two specific criteria in terms of See algoritms 3 and 4 for pseudocode implementation sugges- metrics: an aspect ratio close to the target and an orientation tions. See figures 18 and 19 for treemap examples. of 1. The main cause behind this is that low value nodes can be Algorithm 3 Eat the Poor algorithm placed in the same column as a large value nodes. If this is Require: Root has position, height and width the case, naturally, they will have the same width, and hence Ensure: Root’s children have position, height and width the low value node must have a low height and consequently a high aspect ratio. 1: function EATTHEPOOR( root, ratio = 3 , A solution to this would be to sort the nodes by area. While 2 order = descending) this overwrites the underlying order of the data, it ensures that 2: if root has no children then return root nodes will be placed adjacent to the nodes with the closest 3: if order = descending then amount of area. 4: sort the root’s children by descending value However, another issue remains, regardless of sorting, the last 5: return distributeWidth(root, ratio, ) column allocated will always be constrained in terms of width 6: else → and therefore tend to have lower aspect ratios than the tar- 7: sort the root’s children by ascending value get. Nevertheless, thanks to this neglected column all other 8: return distributeWidth(root, ratio, ) ← columns will have significantly better aspect ratios. 9: return root An unintended interaction between sorting and the last col-

0.109:1 5.53‰ 0.838:1 1.05:1 umn being neglected occurs: it becomes possible to specify 1.35% 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 0.815:1 3.93% what nodes will be discriminated against in terms of aspect ra- 1.18:1 4.00% 4.00% 4.00% 4.00% 4.00% 0.673:1 15.0% 1.21% 0.115:1 1.31:1 5.23‰ 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 tio. If the data is sorted in ascending order, it will be the nodes 1.08:1 1.09% 3.05% 4.00% 4.00% 4.00% 4.00% 4.00% 44.9% 1.44:1 with the highest value, or, if the data is sorted in descending 9.86‰ 1.58:1 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 0.122:1 1.34:1 4.95‰ 9.02‰ 4.00% 4.00% 4.00% 4.00% 4.00% order, it will be the ones with the lowest value. 2.47% 1.72:1 1.50:1 8.30‰ 1.86:1 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 1.60:1 7.68‰ 2.06% 2.00:1 0.128:1 8.16% 4.71‰ 4.00% 4.00% 4.00% 4.00% 4.00% 7.14‰ Discriminating the lowest and highest value nodes respec- 1.88:1 2.15:1 1.76% 6.66‰ 2.27:1 2.30:1 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 2.16:1 6.24‰ tively is useful depending on the data distribution and the 2.45:1 5.39% 1.53% 5.87‰ 4.00% 4.00% 4.00% 4.00% 4.00% usage context of the treemap. So it was decided to gener- (a) Zipf (b) Uniform

7.2e-3:1 5.62‰ alize this principle, which became the basis of the Macro- 0.200:1 0.838:1 1.42% 1.22:1 0.785:1 Economic-Metaphor. 1.20:1 1.39:1 1.25:1 1.64:1 2.90% 1.91:1 5.99% 6.13% 5.62% 5.03% 4.11% 15.6% 13.3% 1.69:1 1.29:1 0.875:1 0.200:1 2.61% 1.42% 1.41:1 1.28:1 4.86% 3.90% The Macro Economic Metaphor (MEM) 0.838:1 6.01% 5.48% 1.91:1 5.99% 1.76:1 1.37:1 1.00:1 Since the treemap root is constrained in terms of having a 1.66:1 2.28% 1.44:1 1.32:1 4.69% 3.68% 0.525:1 15.6% 9.68% 5.43‰ 5.34% 1.19:1 fixed height and width, when removing columns from the re- 1.59:1 5.89% 1.83:1 1.47:1 1.93%

0.525:1 3.16% 5.43‰ 4.51% 3.44% maining area, width can be seen as a limited resource to be 2.25:1 1.66:1 1.36:1 1.50:1 1.48:1 1.91:1 1.53% 1.59:1 1.64:1 1.59:1 1.77‰ 1.64:1 5.18% 2.13:1 1.77‰ 6.44:1 13.3% 493ppm 5.76% 9.68% 3.16% 6.44:1 4.31% 3.18% 1.08% distributed among columns. 493ppm Therefore, the metaphor goes as follows: (c) Normal (d) Log-Normal The poor (lowest value nodes) and the rich (highest Figure 18. Eat the Poor, examples of algorithm results for different data value nodes) can be for the benefit of the many distributions. Please notice the thin strips of squished low value nodes at Squished the right side of the treemaps for a & c. (the rest of the nodes). Also, with the help of Taxation, it is possible to redistribute wealth (width) through taxa- tion (a target aspect ratio offset) and eliminate misery Algorithm 4 Eat the Rich algorithm (a column with too little width left) via economic re- stratification (a reduction in the number of columns). Require: Root has position, height and width Ensure: Root’s children have position, height and width Where Squishing and Taxation are heuristics suggested in this thesis. Squishing improves aspects ratios at the cost of orien- 1: function EATTHERICH( root, 3 tation and Taxation improves orientation at the cost of aspect ratio = 2 , ratios. order = descending) 2: if root has no children then return root MEM Heuristics 3: if order = descending then Squishing 4: sort the root’s children by descending value Sort the data first, then pick a target to be squished, high value 5: return distributeWidth(root, ratio, ) ← nodes (the rich) or low value nodes (the poor). If the data 6: else is sorted in descending order and the target is the rich, or 7: sort the root’s children by ascending value if the data is in ascending order and the target is the poor, 8: return distributeWidth(root, ratio, ) → call DISTRIBUTEWIDTH with a right to left( ) orientation 9: return root parameter. ←

13 1.00:1 0.798:1 9.86‰ 0.775:1 2.47% 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 Subsidy 1.10:1 Algorithm 5 8.16% 9.02‰ 4.00% 4.00% 4.00% 4.00% 4.00%

0.957:1 1.19:1 1.20:1 8.30‰ 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 2.06% Require: Root has position, height and width 1.29:1 4.00% 4.00% 4.00% 4.00% 4.00% 7.68‰ 1.12:1 1.39:1 Ensure: Root’s children have position, height and width 1.18:1 1.76% 7.14‰ 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 44.9% 1.49:1 5.39% 1.29:1 6.66‰ 4.00% 4.00% 4.00% 4.00% 4.00% 1.59:1 1.53% 6.24‰ 1.70:1 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 1.61:1 1.47:1 5.87‰ 1: function SUBSIDY( 1.35% 1.80:1 4.00% 4.00% 4.00% 4.00% 4.00% 5.53‰ 3.93% 1.65:1 1.91:1 3.61:1 1.21% 5.23‰ 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 root 2.08:1 2.02:1 1.83:1 4.95‰ 15.0% 3.05% 1.09% 2.13:1 4.00% 4.00% 4.00% 4.00% 4.00% 3 4.71‰ ratio = 2 (a) Zipf (b) Uniform order = descending

1.6e-2:1 1.77‰ 9.1e-2:1 0.572:1 0.234:1 0.496:1 6.13% maxOffset = ratio 3.16% 1.35:1 1.21:1 1.56:1 1.13:1 2.61% 15.6% 1.52:1 3.90% 1.72:1 6.01% 5.48% 4.86% misery = ratio 9.68% 1.62:1 1.19:1 0.654:1 15.6% 0.496:1 2.28% step = 0.1

1.6e-2:1 1.77‰ 1.38:1 1.24:1 3.16% 4.69% 3.68% 1.52:1 5.89% 5.34% ) 2.02:1 1.69:1 1.28:1 0.776:1 9.68% 1.41:1 1.28:1 4.51% 3.44% 1.93% 2: if root has no children then return root 13.3% 1.11:1 2.47:1 1.42% 5.76% 5.18% 1.76:1 1.38:1 0.979:1 5.9e-2:1 493ppm 1.53% 3: bestFirst 0 5.99% 1.11:1 4.31% 3.18%

5.9e-2:1 2.02:1 1.42% 493ppm 1.32:1 ← 2.47:1 1.45:1 1.39:1 4: bestTargetAR ratio 2.94:1 1.85:1 1.51:1 1.08%

0.260:1 5.43‰ 117ppm 5.03% 0.260:1 2.94:1 117ppm 5.62% 2.70:1 ← 1.64:1 13.3% 23.6ppm 5.99% 1.64:1 4.11% 2.90% 5.43‰ 23.6ppm 5.62‰ 5: for offset 0; offset < maxOffset; offset += step do ← (c) Normal (d) Log-Normal 6: current eatThePoor(root, ratio + offset, order) 7: firstRatio← AR(current first child Figure 19. Eat the Rich, examples of algorithm results for different data ← distributions. Please notice the thin highest value node squished at the of last column) 8: if firstRatio misery then return current left side of the treemaps for c & d. And that for d the nodes in the right ≥ are more squished than in Eat the Poor. 9: if firstRatio > bestFirst then 10: bestFirst firstRatio 11: bestTargetAR← ratio ← Taxation 12: return eatThePoor(root, bestTargetAR, order) The MEM algorithms often result in grid-like layouts. Espe- cially as the distribution variance increases and data elements

0.566:1 0.999:1 7.68‰ become more similar in value. 0.973:1 2.06% 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1

0.609:1 7.14‰ 4.00% 4.00% 4.00% 4.00% 4.00% 8.16% 1.17:1 1.76% 1.20:1 0.653:1 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 However, due to the greedy nature of the algorithm it is pos- 6.66‰ 1.35:1 4.00% 4.00% 4.00% 4.00% 4.00% 1.53% 0.698:1 sible for the last column of nodes to be left with little to no 1.48:1 6.24‰ 1.53:1 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 0.743:1 remaining width, and hence be forced to have a vertical orien- 44.9% 5.39% 1.35% 5.87‰ 4.00% 4.00% 4.00% 4.00% 4.00% 1.72:1 1.21% 0.789:1 2.03:1 5.53‰ 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 tation and extreme aspect ratios. 1.91:1 3.93% 1.09% 0.835:1 5.23‰ 4.00% 4.00% 4.00% 4.00% 4.00% 2.62:1 2.11:1 9.86‰ 0.882:1 3.61:1 3.05% 2.31:1 4.95‰ 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 9.02‰ If these nodes had not have been assigned to a column of their 3.24:1 0.929:1 15.0% 2.51:1 4.71‰ 4.00% 4.00% 4.00% 4.00% 4.00% own, the above would not occurr. Instead, nodes in the last 2.47% 8.30‰ column would have an aspect ratio larger than the target. (a) Zipf (b) Uniform

1.6e-2:1 1.77‰ 0.659:1 2.46:1 0.858:1 2.12:1 2.57:1 2.90% Rather than merging the last two columns (a different MEM 1.91:1 1.69:1 5.99% 6.13% 5.48% 4.51% 2.64:1 2.57:1 2.17:1 4.31% 0.957:1 heuristic called move back, which will not be discussed in this 15.6% 13.3% 5.34% 2.61%

1.6e-2:1 1.77‰ 6.01% 2.70:1 thesis), taxation achieves the above by increasing the target 2.33:1 1.25:1 2.72:1 4.11% 3.16% 2.21:1 5.18% 1.09:1 1.91:1 2.85:1 2.28% aspect ratio of all nodes. 9.68% 5.89% 2.80:1 1.25:1 3.90% 15.6% 5.03% 3.02:1 1.30:1 2.33:1 3.16% 2.26:1 1.93%

5.9e-2:1 493ppm 2.90:1 3.68% Hence, at the expense of aspect ratio, orientation is improved. 2.81:1 5.76% 3.24:1 1.64:1

9.68% 5.9e-2:1 493ppm 4.86% 2.25:1 1.42% 1.53% 2.81:1 3.44% 3.77:1 1.42% 2.32:1 3.01:1 2.33:1

0.260:1 7.52:1 117ppm 3.50:1 1.08% 5.43‰ 0.260:1 117ppm 7.52:1 4.54:1

1.64:1 13.3% 23.6ppm 5.99% 1.64:1 5.62% 4.69% 23.6ppm 3.18% See algoritms 5 and 6 for pseudocode implementation sugges- 5.43‰ 5.62‰ tions. See figures 20 and 21 for treemap examples. (c) Normal (d) Log-Normal

Figure 20. Subsidy, examples of algorithm results for different data dis- MEM Algorithms tributions. Please notice the still slightly squished columns in a and d. A combination of the previously mentioned heuristics yields four possible algorithms, as shown in table 1.

METHOD Squishing Three experiments were performed. The first two with the ob- Poor Rich jective of analyzing the evaluation metrics for treemap tiling algorithms. The third one applies the gained insights from No Eat the Poor Eat the Rich Taxation the first two experiments to select a suitable metric as an as- Yes Subsidy Welfare pect ratio aggregate and proceeds to compare Squarify to the MEM-algorithms. Table 1. Treemap tiling algorithms summarized as combinations of For experiments 2 and 3, the Squarify implementation used squishing and taxation. was the one from the visualization library D3 v.4.9.1.

14 Algorithm 6 Welfare This is a valid approach since: Require: Root has position, height and width n Ensure: Root’s children have position, height and width value(Parent)=∑ value(Childi), i=1 1: function WELFARE( and value is proportional to area. Value is used rather than root area in order to avoid float precision errors. This especially 3 ratio = 2 important due to the small sides of rectangles with extreme order = descending aspect ratios. maxOffset = ratio misery = ratio Experiment 1: An invisible outlier step = 0.1 Objective ) This experiment seeks to evaluate different aggregate metrics 2: if root has no children then return root for measurement of aspect ratio. An aggregate for aspect ra- 3: bestFirst 0 ← tio should not show significant skew due to invisible sub-pixel 4: bestTargetAR ratio rectangles. Many authors hypothesize that weighed average 5: for offset 0;← offset < maxOffset; offset += step do ← should address this issue [16, 3, 7]. This experiment will at- 6: current eatTheRich(root, ratio + offset, order) tempt to test that claim experimentally. 7: firstRatio← AR(current first child ← of last column) Methodology 8: if firstRatio misery then return current A synthetic dataset of normally distributed values was gener- ≥ 2 9: if firstRatio > bestFirst then ated (see fig. 27)( N (σ = 5, µ = 10)(x) 0 x < 20 x N ). { | ≤ ∧ ∈ 10: bestFirst firstRatio } 11: bestTargetAR← ratio ← The dataset was then used to calculate two different treemaps 12: return eatTheRich(root, bestTargetAR, order) with a root aspect ratio of 1:1. One using the Slice tiling algo- rithm, and the other one using the Dice tiling algorithm.

1.35:1 1.30:1 1.21% 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 4.00% 4.00% 4.00% 4.00% 4.00% For each treemap, nodes were measured in terms of four dif- 5.39% 1.09% 1.66:1 9.86‰ 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 ferent metrics: aspect ratio, OAAR and FOAAR. 1.55:1 1.78:1 1.81:1 9.02‰ 4.00% 4.00% 4.00% 4.00% 4.00% 3.93% 1.97:1 8.30‰ 2.30:1 2.14:1 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 All metrics were aggregated both through weighted and un- 3.05% 7.68‰ 2.30:1 4.00% 4.00% 4.00% 4.00% 4.00% 44.9% 2.84:1 7.14‰ 2.47:1 weighed mean. For FOAAR, the resulting aggregate metric 2.47% 6.66‰ 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 2.64:1 3.41:1 6.24‰ 4.66:1 2.06% 2.81:1 4.00% 4.00% 4.00% 4.00% 4.00% is multiplicatively inverted after aggregation. The standard 5.87‰ 4.00:1 2.99:1 15.0% 1.76% 5.53‰ 3.16:1 4.61:1 5.23‰ 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 1.53% 3.34:1 deviation of the metrics was also calculated and presented. 8.59:1 4.95‰ 5.25:1 3.53:1 4.00% 4.00% 4.00% 4.00% 4.00% 8.16% 1.35% 4.71‰ (a) Zipf (b) Uniform Results for both treemaps are presented alongside each other

1.6e-2:1 1.77‰ as two different tables so that the rows can be compared side 0.659:1 2.12:1 2.57:1 1.92:1 1.22:1 1.91:1 1.69:1 5.99% 6.13% 5.48% 4.51% 3.18% by side. 2.17:1 2.64:1 2.00:1 1.34:1 15.6% 13.3% 5.34% 4.31% 2.90%

1.6e-2:1 1.77‰ 6.01% Furthermore, aspect ratios for each node are presented as two 2.33:1 1.25:1 2.72:1 2.10:1 1.49:1 2.21:1 5.18% 1.91:1 9.68% 3.16% 4.11% 2.61% bar charts. Another two bar charts depic weighted aspect ra- 5.89% 2.80:1 2.22:1 1.70:1 1.25:1 5.03% 2.28% tios for each treemap. 15.6% 2.33:1 3.16% 2.26:1 3.90%

5.9e-2:1 493ppm 2.90:1 2.35:1 2.02:1 2.81:1 5.76% 1.93%

9.68% 5.9e-2:1 2.25:1 1.42% 493ppm 4.86% 3.68% 2.55:1 2.81:1 2.32:1 1.53% Motivation 3.77:1 1.42% 3.01:1 2.52:1 3.64:1

0.260:1 7.52:1 117ppm 5.43‰ 1.08% 0.260:1 117ppm 7.52:1 7.12:1

1.64:1 13.3% 23.6ppm 5.99% 1.64:1 5.62% 4.69% 3.44% 5.43‰ 23.6ppm 5.62‰ The main purpose of this experiment is to illustrate the level (c) Normal (d) Log-Normal of skew resulting from small rectangles with extreme as- pect ratios. Especially sub-pixel invisible rectangles, which Figure 21. Welfare, examples of algorithm results for different data distri- butions. Please notice that none of the treemaps elicit squished columns. should not be taken into account for the purpose of visualiza- tion. If a resulting metric is representative of the visible rectangles, then it should have a value between the two visible extremes. In all experiments, weighted means use node value, rather Which can be formalized as: than area, as the weights: M(R ) AM(treemap) M(R ) , ∥ smallest visible ∥1 ≤∥ ∥1 ≤∥ largest visible ∥1 Children.length where M is the metric and AM is the aggregate metric. ∑ M(Childi) value(Childi) · M¯ (Parent)= i=1 , It is not difficult to device a value distributions that results in value(Parent) this kind invisible rectangles. The only requirement is that there is enough difference between the largest and the small- where Parent is a treemap node and Children is the list of est elements. For synthetic idealized data, this means that any children treemap nodes. tailed distribution that is not heavy-tailed should suffice. A

15 normal distribution was chosen since it is a popular distribu- The aspect ratios of all nodes were sorted and plotted in a tion that readers are likely be familiar with. bar chart alongside a bimodal distribution resulting from an aggregate of the first and last 50 values. In terms of the distribution parameters, mean and variance, the objective was for all but a single rectangle to be visible. In addition to the above, all nodes were measured in terms A mean of 5 was chosen to create a slight asymmetry (only a of six different metrics: aspect ratio, orientation-agnostic as- single invisible outlier was wanted) and to minimize cut-off pect ratio (OAAR) and fractional orientation-agnostic aspect as it places the center of mass slightly off the middle of the ratio(FOAAR); as well as offset factor and offset quotient of domain. A variance of 5 was chosen so that all but a single 3 aspect ratio with a target of 2 . All metrics were aggregated rectangle were visible. both through weighted and unweighted mean. Standard devi- In terms of the tiling algorithms, Slice and Dice were chosen, ation was also calculated for all metrics. Values are presented as both ensure homogeneous orientation. Slice ensures that alongside what the value for the metric would be in a perfect all rectangles have an orientation of 1, and Dice an orientation solution. of 0. As a matter of fact, the root aspect ratio of 1:1 was chosen so that the produced treemaps are identical to each other except for the orientation of the nodes. The above entails that the aspect ratio distributions for the Motivation Slice treemap will be equivalent to the OAAR distribution for A Zipf distribution was used since it one of the distributions both treemaps. Conversely, the aspect ratio distributions for used by Shneiderman and Wattenberg [16], who did not not the Dice treemap will be equivalent to the FOAAR distribu- obtain conspicuously skewed results. tion for both treemaps. The number of calculated nodes is also deliberate. Squarify attempts to recursively approach a square-like rectangle and hence not allowing it to do just that would not be representa- Experiment 2: Squarify and target aspect ratio tive of how the algorithm is meant to achieve favorable results. Objective A hundred nodes were arbitrarily chosen as a relatively large Only a small fraction of the previous literature does ex- number of nodes for a single level (bear in mind that the ex- hibit the extreme distortion that should be caused by the un- periment only represents the top level of the treemap). weighted arithmetic mean of aspect ratio (e.g. [3, 9]). For the most part, however, other authors obtain reasonable values A target aspect ratio for Squarify was chosen based on the that are not immediately conspicuous (e.g. [6, 16, 17]). Also, results of Heer and Bostock [10], Kong et al. [13]. The root authors do not mention having encountered difficulties with aspect ratio was the same to more accurately account for the recursive nature of treemaps (for instance, in a perfect solu- the metric which is suspicious in itself as very specific data 3 distributions are necessary for this to be the case. Specifically, tion, all children would have parents with aspect ratio 2 ex- there need be no large differences between node values; or if pect for those at the first level of depth). an orientation-agnostic metric is not being used, all low value A plot of the aspect ratio visualizes the actual capability of nodes need be represented as vertically oriented rectangles. Squarify to yield the target aspect ratio. It would then be ev- Additionally, as mentioned before, the algorithm’s inability to ident if Squarify is obtaining its desirable mean aspect ratios actually achieve the target aspect ratio has been pointed out through non-representative aggregation. If that were to be the by multiple authors [10, 13]. It is even conspicuously obvious case, the values would not be close to the resulting mean and if the aspect ratios are written on the nodes as in figures: 3 11, instead there would be just as much mass above as below the 29, 22 and 45. mean. Nevertheless, Squarify seems to be able to yield aggregate Additionally, the reason the aggregate metrics are calculated metrics that are often not representative of the nodes that it is so that they can be compared with the values for the perfect actually produces. solution as well as the actual aspect ratio distribution. If the resulting value is close to the perfect value but the aspect ratio Lastly, as mentioned in Offset factor (3.5.3) , for algorithms distribution does not reflect this then the metric is not repre- that take in a target aspect ratio as a parameter, the only valid sentative. In summary, the aggregate metric should reflect the frame of reference is the target. This experiment will hence aspect ratio distribution. include two of my own metrics that measure distance from target: offset factor and offset quotient. The graph with the bimodal distribution is meant to test a hy- pothesis: that Squarify obtains its favorable results by having Method a roughly equal number of vertical and horizontal rectangles. A synthetic dataset of Zipf distributed values was generated If this is true, then the average of the last 50 rectangles (half ( Zipf(s = 1)(x) 0 x < 100,x N ). the total amount) should be the multiplicative inverse of the { | ≤ ∈ } average of the first 50. Since Squarify is built on OAAR and The dataset was then used to calculate a treemap using the cannot distinguish between a number an its multiplicative in- 3 Squarify tiling algorithm with a target aspect ratio of 2 . verse this should still yield an perfect aggregate value.

16 Experiment 3: comparison between Squarify and the distribution of the right variance and mean should be able to MEM algorithms approximate to an extent the value distribution. Objective This methodology stands in stark contrast to previous method- This experiment aims to compare Squarify to the Macro- ology. In the literature Monte Carlo trials of synthetic data Economic algorithms. It should also elicit the strengths and seem to be the universal approach[6, 16, 3, 9, 17, 7]. How- weaknesses of the different algorithms in terms of aspect ratio ever, there is a significant flaw to this methodology; namely, and orientation. that the data distributions need not be representative of the en- The third experiment follows different methodology than the tire possibility room. While experiment 1 and 2 are examples previous two. Rather than illustrate edge cases that highlight of this phenomenon to an extent, they are not as extreme as the deficiencies of certain aggregates metrics, the idea is to they could be. create an somewhat exhaustive representation of the distribu- tion room in order to find patterns. Method 0.778:1 A three-dimensional matrix D was calculated: 1.61:1 26.1% 2 y 2 D = N (σ = 2 4 − , µ = x)(z) { . 0 x < 50 0 y < 50 0 z < 50 x,y,z N . 37.1% | ≤ ∧ ≤ ∧ ≤ ∧ ∈ } For every mean and variance in the matrix, a treemap was cal- 0.323:1 culated for the z values. For each treemap, two aggregate met- 2.30:1 1.54% rics were calculated inverse weighted mean offset quotient of 1.60:1 aspect ratio and weighted mean orientation.

0.153:1 53.8ppm 26.1% 9.03% 3.53:1

7.5e-2:1 1.30‰ 0.0111ppm 7.31:1 1.10ppm

15.0:1 The above process generates 2500 treemaps, which are used 0.0000553ppm as the data for a single algorithm. The process and was re- peated for each tiling algorithm. Five algorithms were exam- 2 √2 Figure 22. A Squarify treemap of N (σ = 2 , µ = 0)(x) 0 x < 10 ined: Squarify, Eat the Poor, Eat the Rich, Welfare and Sub- x N . The aspect ratio of the remaining{ area becomes more| ≤ extreme∧ sidy. In total 12500 treemap were calculated and measured with∈ with} each layouted node. Which results in extreme aspect ratios. in terms of orientation and weighted offset quotient of aspect Even though this treemap only has 10 nodes, it has an average OAAR of ratio. This is the dataset for the experiment. 105, and the smallest node has an aspect ratio of 424. From the dataset, three sets of contour plot are produced for A more extreme demonstration, is a distribution specifically every algorithm: designed to make Squarify fail at squarification. There exists such a region in the space of possible normal distributions that 1. The raw data not only ensures failure, but even entails that every node will have a more extreme aspect ratio than the node before. Squar- 2. The deterioration difference image ify treemaps of a normal distributions with a variance around 3. The improvement difference image √2 2 exhibit that behavior (see fig. 22 for such a treemap). The last two sets of contour plots subtract the Squarify ag- However, it does not need to be that exact distribution, any gregate metrics from those of the MEM algorithms. A neg- data resembling any distributions in the proximity will elicit ative difference in terms of offset quotient of aspect ratio, the same exceptional effects. as well as positive difference in orientation, are considered Hence, results are cherry-picked by choice of experimental improvements in terms of performance (Experiment 3B) and method. Even if the researcher does not intend to do so. In vice versa (Experiment 3A). a Monte Carlo trial this occurs due to the random sampling. Each of the experiments was assigned its own color scheme, Via the center-limit-theorem even when independent random where green represents favorable values and red unfavorable variables are added, in this case due to aggregation, the end values. Experiment 3A and 3B use a sequential color scheme result will approximate a normal distribution as the number for deterioration and improvement respectively. Experiment of samples increases. 3C uses a divergent color scheme where the ideal value is For the above reasons the idea was to calculate the entire two green and everything beyond one unit of undesirable offset is dimensional room of means and variances for normal distri- red. butions that should portray the entire possibility room. Motivation Since the index domain for the treemap data is 0 to 50, it was Since the algorithmic implementations of the MEM heuristics used as the mean domain as well (see fig. 23a). Additionally, currently require sorting the values, there is a limited number it was decided to have just as many values in terms of vari- of fundamentally different value distributions. As long as the ance so that the resolution in terms of x and y are the same. distribution of the data is continuous and unimodal a normal Nevertheless, for variance to go from a single spike with all

17 μ=0 80% σ² = 0.25 μ=1 σ² = 0.3 μ=2 σ² = 0.35 σ² = 0.42 14% μ=3 μ=4 σ² = 0.5 μ=5 σ² = 0.59 μ=6 70% σ² = 0.71 μ=7 σ² = 0.84 μ=8 σ² = 1 12% μ=9 σ² = 1.19 μ=10 σ² = 1.41 μ=11 60% σ² = 1.68 μ=12 σ² = 2 μ=13 σ² = 2.38 μ=14 σ² = 2.83 10% μ=15 σ² = 3.36 μ=16 σ² = 4 μ=17 50% σ² = 4.76 μ=18 σ² = 5.66 μ=19 σ² = 6.73 μ=20 σ² = 8 8% μ=21 σ² = 9.51 μ=22 40% σ² = 11.31 μ=23 σ² = 13.45 μ=24 σ² = 16 μ=25 σ² = 19.03 μ=26 σ² = 22.63 6% μ=27 σ² = 26.91 μ=28 30% σ² = 32 Portion of total density Portion of total density μ=29 σ² = 38.05 μ=30 σ² = 45.25 μ=31 σ² = 53.82 μ=32 σ² = 64 4% μ=33 20% σ² = 76.11 μ=34 σ² = 90.51 μ=35 σ² = 107.63 μ=36 σ² = 128 μ=37 σ² = 152.22 μ=38 σ² = 181.02 2% μ=39 10% σ² = 215.27 μ=40 σ² = 256 μ=41 σ² = 304.44 μ=42 σ² = 362.04 μ=43 σ² = 430.54 σ² = 512 0% μ=44 0% μ=45 σ² = 608.87 μ=46 σ² = 724.08 σ² = 861.08 μ=47 0 10 20 30 40 0 10 20 30 40 μ=48 σ² = 1024 μ=49 σ² = 1217.75 x y

(a) The different variances (µ = 25) (b) The different means (σ 2 = 25)

Figure 23. Experiment 3: Two orthogonal 2D slices of the 3D distribution matrix. The slices are represented as line charts. These images are meant to prodivide a sense of the distribution coverage of the matrix, for instance, for 23 b, please notice how the distributions go from an almost degenerate distribution to an almost uniform distribution. the density to a quasi-uniform distribution, linear increments Furthermore, the reason the experiment was divided into three of the data do not suffice. For this reason it was decided to parts is because difference plots simplify the comparison and use exponential increment calculated through the following more clearly portray the areas in which Squarify and the expression: MEM algorithms differ from Squarify. Nevertheless, all the same conclusions could potentially be derived from the raw index data alone (experiment 3C). Briefly summarized, experiment 4 2 incrementσ 2 (index)=2 − . 3A shows when the MEM algorithms perform worse than Squarify, 3B when they perform better and 3C is not a com- The expression was chosen so that the resulting variance parison but an overview of how the algorithms perform on 1 ranges from 4 to over 1024. An interval that was determined their own. through previous plotting to contain the interesting value vari- ations. It was expected for such an interval to exist, be- RESULTS 2 cause when σ ∞ the value distribution approximates a Experiment 1: An invisible outlier uniform distribution→ and when σ 2 0 the value distribution → The value distribution (see fig.27) and the resulting Dice and approaches the degenerate distribution where a single index Slice treemap (see fig.24) were compared to the aggregate has all the value (see fig. 23b). metrics fig.2. Contour plots were chosen to portray the data rather than The treemaps had the expected appearance with only a single heatmaps because the clustering of the values is more im- rectangle being invisible (the one with index 0 in the distribu- portant than the exact value of individual data points. Nev- tion). ertheless, the exact implementation of the curve smoothing is unimportant as the same results could be derived from a However the aspect ratio distributions are a cause for concern. heatmap. For this thesis the contour plot implementation used While for the Dice treemap the values behave almost linearly, is the one from Plotly 1.26.0. in those for the Slice treemap there is a extreme skew in favor of the lowest value-nodes (Let it be kept in mind that the slice For every algorithm two metrics are evaluated as two separate treemap is representative of how OAAR behaves). contour plots: inverse weighted mean of offset quotient and orientation. The reason why these two metrics are used in Previous authors assumed that without weighting, arithmetic conjunction is that a perfect value of both metrics ensures a mean of OAAR would be representative of all rectangles perfect solution. The same could be said for weighted mean equally, however, as figure 27 suggests by exhibiting an ex- of offset ratio and orientation, but offset quotient is less sus- ponential growth pattern, it is mainly the sub-pixel nodes that ceptible to outliers for which it was chosen over offset ratio. are being represented by the metric, while the aspect ratios

18 1.7e-3:1 1.0e-2:1 1.0e-2:1 1.70‰ 4.2e-2:1 4.2e-2:1 1.03% 1.03% 0.114:1 0.114:1 4.18% 4.18% 0.253:1 0.207:1 0.207:1 11.4% 11.4% 25.3% 20.7% 20.7% 3.95:1 25.3% 4.83:1 20.7% 4.83:1 20.7% 8.80:1 11.4% 8.80:1 11.4% 23.9:1 4.18% 23.9:1 4.18% 97.0:1 1.03% 97.0:1 1.03% 587:1 1.70‰ (a) Dice (b) Slice

Figure 24. Experiment 1: Aspect ratio distribution by descending node area.

600 0.25

500 0.2

400

0.15

300

Aspect Ratio 0.1 Aspect Ratio 200

0.05 100

0 0 0 2 4 6 8 0 2 4 6 8

Index by descending area Index by descending area

(a) Dice treemap (or FOAAR for both) (b) Slice treemap (or OAAR for both)

Figure 25. Experiment 1: Aspect ratios for nodes in descending area order. Please notice the linear descent on a and the superlinear growth on b. of the largest nodes by area are mostly ignored. This is the outlier. Which means that OAAR is not visually representa- opposite to visual representation. tive for treemap tiling algorithm evaluation. The aggregate metrics confirm the above(see fig.2), with a Unlike OAAR, unweighted mean of FOAAR is visually repre- mean OAAR of 86 which is far beyond any visible rectangles sentative. FOAAR also exhibits the lowest standard deviation in the visualization. Consequently it can be concluded that among all metrics(σ = 0.126). it exhibits extreme skew due to the single invisible sub-pixel

19 Parameters Parameters

Aggregate Metric Value Aggregate Metric Value

Aspect Ratio 86.0 Aspect Ratio 0.100 Arithmetic Mean Arithmetic Mean OAAR 86.0 OAAR 86.0 1 1 Arithmetic Mean− FOAAR 10.0 Arithmetic Mean− FOAAR 10.0

Aspect Ratio 10.0 Aspect Ratio 0.179 Weighted Mean Weighted Mean OAAR 10.0 OAAR 10.0 1 1 Weighted Mean− FOAAR 5.59 Weighted Mean− FOAAR 5.59

Aspect Ratio 0.0938 Aspect Ratio 180 Standard Deviation (σ) Standard Deviation (σ) OAAR 180 OAAR 180 FOAAR 0.0938 FOAAR 0.0938

(a) Dice (b) Slice

Table 2. Experiment 1: Node aggregates for the Dice(left) and Slice(right) treemaps.

1.0 0.030

0.80 0.025

0.020 0.60

0.015 0.40

0.010 Weighted Aspect Ratio Weighted Aspect Ratio

0.20 0.0050

0.0 0.0 0 5 10 15 0 5 10 15

Index by descending value Index by descending value

(a) Dice treemap (or FOAAR for both) (b) Slice treemap (or OAAR for both)

Figure 26. Experiment 1: Aspect ratios for nodes in descending area order. Please notice the linear descent on a and the superlinear growth on b.

Likewise, the weighted means of all three metrics are visu- the most representative for the visible rectangles. With the ally representative. While previous researchers assumed that current color scheme, a rectangles with the same value as as- weighting the rectangles would result in a skew in favor of pect ratio would be placed fourth by descending area order, nodes with large areas this does not seem to be the case. None in between the Han-blue(#506ad9) and aquamarine(#1ad5b2) of the values expect for weighted mean of FOAAR, are even rectangles. within the same order of magnitude as the largest node in the Furthermore, some of same authors that thought that mean visualization. OAAR would yield an equal representation of nodes also Furthermore, of all aggregate metrics, weighted FOAAR per- assumed that by weighting the mean, the results would be formed overall best( 0.179 = 5.58) with the value that is overly skewed in favor of large-nodes. Nevertheless as figure ∥ ∥1

20 an orientation-agnostic metric was used. • The first was graphically shown(as fig. 28b) in the form of a bi-modal uniform distribution resulting from averaging the highest and lowest 50 values. The highest 50 aspect ratios 25% average to 1.51 while the lowest 50 average to 0.690. This should not be the case for a perfect solution, which would

20% have all aspect ratios be 1.5. Not even an orientation-agnostic perfect solution would be satisfied, as 1.51 and 0.690 are both higher than their respective targets. 15% Once more, aspect ratio is shown not to be suitable for ag- gregation, with a value of 1.10 there is not a single rectangle in the visualization within 1% of the aggregate metric. Yet 10% again this a reminder of why± it is mostly OAAR that is used

Portion of total density in literature. Albeit, the rest of the experiment also creates doubt about the validity of OAAR as an evaluation metric for 5% treemap tiling algorithms. Fortunately, inverse arithmetic mean of FOAAR, the other 0% 0 2 4 6 8 orientation-agnostic metric, does yield a representative result, although it might not be apparent. If the aspect ratios are Index above what they should be in both instances why is FOAAR 1.46 (<1.50)? There are two reasons:

Figure 27. The dataset used for experiment 1A ( N (σ 2 = 5, µ = 10)(x) FOAAR reduces the impact of extreme aspect ratios and 0 x < 10 x N ). Please notice the relatively{ small value of index 0,| • hence of outliers. as≤ this is the∧ invisible∈ } node in the visualization.

26 elicits, for OAAR, there is no visible skew in favor of large A positive surplus on the nodes that aim for a multiplica- nodes. Actually, the opposite seems to apply, weighting coun- • terbalances the inherent skew of the aggregate metric yielding tive inverse of the target entails a negative deficit in the more equal representation. proportionality constant between sides. Or put into sim- pler terms: that vertical rectangles are closer to a square As a side note, the results of this experiment also illustrates than they should be. why orientation-agnostic metrics are necessary for aggrega- tion of treemap nodes with mixed orientation. Since rectan- Nevertheless, a perfect FOAAR score would still not entail a gles of different orientations grow in different directions(one perfect solution. Nonetheless, offset factor and offset quotient increases and the other one decreases in relationship to area) of aspect ratio do guarantee a perfect solution. Furthermore and at different rates (one goes from one to infinity while the they both yield more visually representative results. This is other one goes from one to zero), the mean value of aspect because they take into account that target aspect ratio is 1.5 ratio will be representative of neither orientation. and not 1. Meanwhile, OAAR and FOAAR are equivalent to offset factor and offset quotient with an target aspect ratio of 1. Experiment 2: Squarify and target aspect ratio The value distribution (see fig.28a) and the resulting Squarify Offset factor and offset quotient suggest that aspect ratios treemap(29) were compared to the aggregate metrics fig.3. have deviated 69% and 50% in average respectively. Which is credible, especially in the case of offset quotient, since 50% The first thing to notice is the perfect result for arithmetic of 1.502 is 0.750 and roughly half the rectangles have an as- mean of OAAR. The target was an aspect ratio of 1.50 and pect ratio around 1/1.50 = 0.667; so, in average, the number the arithmetic mean of OAAR is 1.50 as well. One would should be somewhere between 0.667 and 1, which it is. The assume that such a result would be indicative of a perfect so- differences in value between offset factor and offset quotient lution, nevertheless, both the treemap and the aspect ratio dis- can be argued for in the same manner as the differences for tribution tell otherwise. OAAR and FOAAR; offset quotient reduces the impact of ex- Only three out of a hundred nodes are within 1% of the 1.50 treme aspect ratios in relationship to the target and hence of target. However, There are three main reasons± why it is still outliers. is able to achieve a perfect result: Weighted aggregates, once again, show no apparent skew to- the top 50 aspect ratios roughly average to the target aspect ward high area nodes. Considering placement in descending • ratio area order and that squarification ensures that the outliers will arise early rather than late in late in layout placement, outliers the bottom aspect ratios roughly average to the multiplica- should have larger than average areas. Nevertheless, all of the • 1 tive inverse of the target (1.50− = 0.667) weighted metrics, instead, appear to reflect central tendency.

21 3 3

2.5 2.5 o i t

2 a 2 R t c e p s 1.5 1.5 Aspect Ratio Average A 1 1

0.5 0.5

0 0 0 20 40 60 80 0 20 40 60 80

Index by descending aspect ratio Index by descending aspect ratio

(a) Aspect ratio distribution (b) Average of first and last 50

Figure 28. Experiment 2: Aspect ratio distribution by descending aspect ratio. Table 3. Experiment 2: aggregate metrics for the treemap. 0.675:1 0.493:1 1.02:1 4.74% 3.46% 1.05:1 7.18% Parameters Aggregate Metric Ideal Value 0.741:1 0.668:1 0.606:1 0.554:1 0.831:1 7.93‰ 1.12:1 1.19% 1.06% 9.55‰ 8.67‰ 2.69% Aspect Ratio 1.50 1.10 39.5% 0.890:1 0.823:1 0.765:1 0.714:1 0.669:1 0.629:1 5.16‰ Arithmetic Mean 7.30‰ 6.75‰ 6.27‰ 5.86‰ 5.49‰ 1.39:1 OAAR 1.50 1.50 0.796:1 0.762:1 0.730:1 0.701:1 0.674:1 0.649:1 0.625:1 1.16:1 3.59‰ 3.44‰ 3.29‰ 3.16‰ 3.04‰ 2.93‰ 2.82‰ 2.17% 4.86‰ Offset Factor 1.00 1.69 0.798:1 0.776:1 0.754:1 0.733:1 0.714:1 0.695:1 0.678:1 1.23:1 1.46:1 2.17‰ 2.11‰ 2.05‰ 2.00‰ 1.94‰ 1.89‰ 1.84‰ 1.66:1 4.60‰ 2.72‰ 1.51:1 0.703:1 0.688:1 0.674:1 0.660:1 0.647:1 0.634:1 0.621:1 1.55:1 1.53‰ 1.50‰ 1.46‰ 1.43‰ 1.41‰ 1.38‰ 1.35‰ 1.30:1 2.63‰ 1.80‰ 1.82% 4.36‰ 1.56:1 1.59:1 0.757:1 0.744:1 0.732:1 0.719:1 0.707:1 0.696:1 FOAAR 1.50 1.46 1.75‰ 1.41:1 1.19‰ 1.17‰ 1.15‰ 1.13‰ 1.11‰ 1.09‰ 2.54‰ 1.33‰ 1.63:1 1 1.36:1 1.61:1 1.44:1 1.71‰ 1.37:1 0.768:1 0.757:1 0.746:1 0.735:1 0.725:1 Arithmetic Mean 951ppm 937ppm − 1.94:1 1.30‰ 994ppm 979ppm 965ppm 4.14‰ 2.46‰ 1.07‰ 1.67:1 1.47:1 3.16:1 1.39:1 1.67:1 1.67‰ 1.28‰ 1.42:1 0.713:1 0.704:1 0.694:1 0.685:1 1.55% 1.06‰ 874ppm 863ppm 852ppm 841ppm Offset Quotient 1.00 1.50 1.43:1 2.38‰ 1.71:1 924ppm 1.49:1 1.41:1 1.63‰ 1.44:1 3.94‰ 1.25‰ 1.04‰ 0.514:1 0.508:1 0.502:1 1.72:1 911ppm 1.73:1 799ppm 789ppm 779ppm 1.75:1 830ppm 2.24:1 2.31‰ 1.52:1 1.43:1 1.46:1 1.60‰ 1.23‰ 1.02‰ 1.75:1 1.50:1 899ppm 819ppm 1.77:1 1.79:1 1.55:1 1.45:1 1.48:1 1.19:1 1.17:1 13.2% 1.77:1 770ppm 761ppm 1.35% 3.76‰ 1.01‰ 2.24‰ 1.56‰ 1.21‰ 886ppm 809ppm Aspect Ratio 1.50 1.32

Figure 29. Experiment 2: A Squarify treemap of Zipf(k,s) 1 < k Weighted Mean OAAR 1.50 1.52 100 k N s = 1 . { | ≤ ∧ ∈ ∧ } Offset Factor 1.00 1.68

1 FOAAR 1.50 1.32 Weighted Mean− Offset Quotient 1.00 1.57

Aspect Ratio 0 0.485 Again, FOAAR exhibits the lowest standard deviation; FOAAR is followed by offset quotient. What is worrying OAAR 0 0.271 however, it the high variance of offset factor. While the met- Deviation FOAAR 0 0.102 ric does entail a perfect solution, it should probably not be used for aggregation. Offset Factor 0 0.577 In conclusion, this experiment has highlighted why previous Offset Quotient 0 0.227 literature has had such positive results with Squarify in con- junction with OAAR and once more, why mean OAAR is not representative of the actual distribution of node aspect ratios.

22 1024 1024 Experiment 3: comparison between Squarify and the 0 1 512 512 −0.1 0.9 MEM algorithms 256 256 −0.2 0.8 128 128 As mentioned in the method section, experiment 3A elicits −0.3 0.7 64 64

−0.4 0.6 the regions in which Squarify performs better than the MEM 32 32

−0.5 0.5 16 16 algorithm, 3B the regions in which the MEM algorithms per- Variance Variance −0.6 0.4 form better than Squarify and 3C the actual value of the met- 8 8 4 −0.7 4 0.3 rics. For 3C a value of 1 for inverse weighted mean offset 2 −0.8 2 0.2 quotient of aspect ratio is only possible for a perfect solution. 1 −0.9 1 0.1 0.5 0.5 −1 0

0.25 0.25 There are so many images for this experiment that a smaller 0 10 20 30 40 0 10 20 30 40 version of the images will be included in the text, and a larger Mean Mean version as an annex. (a) Inverse weighted mean offset (b) Orientation. quotient of aspect ratio.

1024 1024 2 1 512 512 Figure 32. Positive difference of Squarify minus Squarify. As a sanity

1.9 0.9 256 256 check, these should be blank.

1.8 0.8 128 128

1.7 0.7 64 64

1.6 0.6 32 32 Orientation (figures: 30b, 31b and 32b) 16 1.5 16 0.5 Variance Variance

1.4 0.4 Squarify seems to have a bias for horizontal placement. Per- 8 8

4 1.3 4 0.3 formance is better than expected, but far from ideal.

2 1.2 2 0.2

1 1 1.1 0.1 Even in terms of this metric, Squarify displays horizontal

0.5 0.5 1 0 stripe pattern, with the two best stripes in between disribu- 0.25 0.25 0 10 20 30 40 0 10 20 30 40 tions with low variance (i.e. high value inequality) where Mean Mean 100% of the nodes are placed horizontally. Unfortunately, (a) Inverse weighted mean offset (b) Orientation. these regions are adjacent to its worst performing region, quotient of aspect ratio. once again, those distributions where it fails as Squarifica- Figure 30. Squarify performance for normally distributed data. tion; there as many as 90% of the nodes might be placed ver- tically instead (albeit, the exponentially increasing aspect ra- tios might be the more significant legibility concern). Hence, due to the high instability, Squarify is unlikely to be a desir- 1024 1024 1 0 able tiling algorithm for labeled treemaps even for low vari- 512 512 0.9 −0.1 256 256 ance distributions. Low variance for a normal distribution can 0.8 −0.2 128 128 be interpreted as: when there is a large difference and abrupt 0.7 −0.3 64 64 0.6 −0.4 transition between the highest and the lowest values. 32 32

0.5 −0.5 16 16 Variance Variance

0.4 −0.6 Overall, for more uniform distributions, Squarify can be ex- 8 8

4 0.3 4 −0.7 pected to layout 60 70% of the rectangles horizontally.

2 0.2 2 −0.8 −

1 0.1 1 −0.9 1024 1024 2 1 0.5 0.5 512 512 0 −1 1.9 0.9 0.25 0.25 256 256 0 10 20 30 40 0 10 20 30 40 1.8 0.8 Mean Mean 128 128

1.7 0.7 64 64

1.6 0.6 (a) Inverse weighted mean offset (b) Orientation. 32 32 16 1.5 16 0.5

quotient of aspect ratio. Variance Variance 8 1.4 8 0.4

Figure 31. Negative difference of Squarify minus Squarify. As a sanity 4 1.3 4 0.3 check, these should be blank. 2 1.2 2 0.2 1 1 1.1 0.1

0.5 0.5 1 0

0.25 0.25 0 10 20 30 40 0 10 20 30 40 Squarify Mean Mean A difference of Squarify against itself verifies that the right (a) Inverse weighted mean offset (b) Orientation. values are being substacted from the MEM algorithms in sub- quotient of aspect ratio. sequent experiments. Figure 33. Eat the Poor for normally distributed data. As a final interesting remark, the region mentioned in the Method section where Squarify fails at squarification, and re- Eat the Poor sults in exponentially increasing aspect ratios, can be clearly Aspect ratio (figures: 33a, 34a and 35a) seen as the red stripe at the bottom of figure 32. Unfortunately, Of all algorithms presented in this paper, Eat the Poor is over- as it will be seen later in this section, the main regions where all the one that performs the best in terms of orientation. As Squarify performs best in comparison to the MEM algorithms it can be seen in figure 34, Squarify only performs marginally are adjacent to this stripe. better than Eat the Poor for low variance normal distributions

23 1024 1024 1024 1024 1 0 2 1 512 512 512 512 0.9 −0.1 1.9 0.9 256 256 256 256 0.8 −0.2 1.8 0.8 128 128 128 128 0.7 −0.3 1.7 0.7 64 64 64 64

0.6 −0.4 1.6 0.6 32 32 32 32

0.5 −0.5 1.5 0.5 16 16 16 16 Variance Variance Variance Variance

0.4 −0.6 1.4 0.4 8 8 8 8

4 0.3 4 −0.7 4 1.3 4 0.3

2 0.2 2 −0.8 2 1.2 2 0.2

1 1 1 0.1 1 −0.9 1.1 0.1

0.5 0.5 0.5 0.5 0 −1 1 0

0.25 0.25 0.25 0.25 0 10 20 30 40 0 10 20 30 40 0 10 20 30 40 0 10 20 30 40

Mean Mean Mean Mean

(a) Inverse weighted mean offset (b) Orientation. (a) Inverse weighted mean offset (b) Orientation. quotient of aspect ratio. quotient of aspect ratio.

Figure 34. Deterioration difference image for Eat the Poor minus Squarify. Figure 36. Eat the Rich for normally distributed data.

1024 1024 1 0

512 512 0.9 −0.1 1024 1024 0 1 256 256 512 512 0.8 −0.2 −0.1 0.9 128 128 256 256 0.7 −0.3 −0.2 0.8 64 64

128 128 0.6 −0.4 −0.3 0.7 32 32 64 64 0.5 −0.5 16 16

−0.4 0.6 Variance Variance 32 32 0.4 −0.6 8 8 −0.5 0.5 16 16 Variance Variance 4 0.3 4 −0.7 −0.6 0.4 8 8 2 0.2 2 −0.8 4 −0.7 4 0.3 1 0.1 1 −0.9 2 −0.8 2 0.2 0.5 0.5 0 −1 1 −0.9 1 0.1 0.25 0.25 0 10 20 30 40 0 10 20 30 40 0.5 0.5 −1 0 Mean Mean 0.25 0.25 0 10 20 30 40 0 10 20 30 40 Mean Mean (a) Inverse weighted mean offset (b) Orientation. (a) Inverse weighted mean offset (b) Orientation. quotient of aspect ratio. quotient of aspect ratio. Figure 37. Deterioration difference image for Eat the Rich minus Squarify. Figure 35. Improvement difference image for Eat the Poor minus Squarify.

1024 1024 0 1

512 512 −0.1 0.9

256 256 −0.2 0.8 (a very thin stripe of less than 20% better values, and wider 128 128 −0.3 0.7 64 64 stripe of less than 10% better aspect ratios. Also with the no- −0.4 0.6 32 32

−0.5 0.5 16 16

table exception of the region at which Squarify fails at squar- Variance Variance

−0.6 0.4 ification). 8 8 4 −0.7 4 0.3 In what regards improvement, Eat the Poor can be expected 2 −0.8 2 0.2 to have 20 30% better aspect ratios than Squarify, and 40% 1 −0.9 1 0.1 0.5 0.5 − −1 0 0.25 0.25 better for more uniform distributions. 0 10 20 30 40 0 10 20 30 40

Mean Mean Actually, the more uniform a distribution is the better that the algorithm will perform, being able to achieve perfect so- (a) Inverse weighted mean offset (b) Orientation. lutions for a uniform distributions (then it results in a perfect quotient of aspect ratio. grid, albeit this is common trait to all MEM-algorithms). Figure 38. Improvement difference image for Eat the Rich minus Squarify.

Orientation (figures: 33b, 34b and 35b) With a few exceptions when there are large differences be- tween data values, Eat the Poor can be expected to layout Eat the Rich 15 30% more nodes horizontally than squarify. − Aspect ratio (figures: 36a, 37a and 38a) Overall, the algorithm performs well with at least 70 80% of Eat the Rich offers good performance for those regions when the rectangles being laid horizontally. Outside of the− critical there is a vast difference and abrupt transition between the region where Squarify fails at squarification, where it results highest and the lowest values in the data (the bottom of the in only in 30 40% of the rectangles being horizontal. For plot). These are some of the same the regions where Eat the more uniform− distributions 100% or the rectangles are hori- Poor under-performs at. However, the above comes at the zontal. expense worse aspect ratios everywhere else.

24 1024 1024 As all MEM algorithms, the aspect ratios for Eat the Rich 2 1 512 512

1.9 0.9 improve gradually up to a perfect solution. This occurs as the 256 256 1.8 0.8 distribution variance increases up to a uniform distribution. 128 128 1.7 0.7 64 64

1.6 0.6 Compared to Squarify, the algorithm performs only signifi- 32 32 16 1.5 16 0.5 cantly worse in a wide intermittent stripes between variances Variance Variance 8 1.4 8 0.4

1 and 4 where it can be expected to result in aspect ratios 4 1.3 4 0.3 10 20% worse. However, a variance of 2 higher is the region 2 1.2 2 0.2 1 1 when− Eat the Poor starts to excel over Squarify, so if the data 1.1 0.1 0.5 0.5 1 0 is known to be within this range that algorithm would proba- 0.25 0.25 0 10 20 30 40 0 10 20 30 40 bly be the better choice. However, beyond a certain variance Mean Mean it no longer matters as Eat the Rich will start approximating (a) Inverse weighted mean offset (b) Orientation. a perfect solution. quotient of aspect ratio.

Orientation (figures: 36b, 37b and 38b) Figure 39. Subsidy for normally distributed data. Although it might seem strange that there are stripes of lower

1024 1024 performance for data with large, but not enormous, differ- 1 0

512 512 ences in values (variances 0.3 to 0.4), this was expected. The 0.9 −0.1 256 256 reason why, is that underneath this region there is a dominat- 0.8 −0.2 128 128 0.7 −0.3 ing largest node that is constrained mostly by the aspect ratio 64 64 0.6 −0.4 of the root. However, when the region is reached, other nodes 32 32 0.5 −0.5 16 16 Variance Variance

0.4 −0.6 have eaten into the largest node to the extent where it is thin- 8 8 ner than a square but it does not fit together with the second 4 0.3 4 −0.7 largest node in a column. Nonetheless, after this point has 2 0.2 2 −0.8 1 0.1 1 −0.9 been past, no node will be large enough to occupy its own 0.5 0.5 0 −1

0.25 0.25 column alone. 0 10 20 30 40 0 10 20 30 40

Mean Mean Other than this there are a a few intermittent strips where Eat the Rich will have between 5 to 15% of less total nodes hori- (a) Inverse weighted mean offset (b) Orientation. zontally oriented when compared to Squarify. However, there quotient of aspect ratio. are also two smaller more focused stripes where there are be- Figure 40. Deterioration difference image for Subsidy minus Squarify. tween 20 to 40% less total horizontal nodes.

1024 1024 Furthermore, there is a wide intermittent strip between vari- 0 1 512 512 ances 1 and 2 where the values can grow up to 47% less hori- −0.1 0.9 256 256 −0.2 0.8 zontal nodes. 128 128 −0.3 0.7 64 64

−0.4 0.6 This is was not unexpected either, as it was hypothesized that 32 32 −0.5 0.5 16 16 there should be configurations where low value nodes have Variance Variance −0.6 0.4 8 8 too little value and are too few in number to stack horizon- −0.7 0.3 4 4 tally, regardless of how much width is taken from the largest 2 −0.8 2 0.2 node. This will result in both low and high value nodes be- 1 −0.9 1 0.1 0.5 0.5 ing squished. Nevertheless, once there are enough low value −1 0 0.25 0.25 0 10 20 30 40 0 10 20 30 40 nodes this will no longer be the case and the layout will im- Mean Mean prove. Or at least, it will improve until the column has once again filled with nodes and a new one is created to house all (a) Inverse weighted mean offset (b) Orientation. quotient of aspect ratio. nodes. This is why these regions are intermittent horizontally. Figure 41. Improvement difference image for Subsidy minus Squarify. Subsidy Since Subsidy builds upon Eat the Poor it should be expected to behave similarly. Nevertheless, it is expected to have worse does not revert to Eat the Poor is when it manages to improve aspect ratios and better orientation. the layout in terms of orientation by increasing aspect ratios.

Aspect ratio Orientation Subsidy elicits some areas of larger aspect ratios that Eat the Subsidy offers much in improved results in regards to orien- Poor did not have. These areas are for the most part similar in tation when compared to Eat the Poor. With the exception of performance to Squarify. Albeit, there are a some small loci two strips, Subsidy can be expected to have up 40% more of with higher such such as 40% or 60% offset. Nevertheless, its total nodes be horizontal, especially for a more uniform these are intended behavior and actually desirable. The rea- dataset. Overall, for most use-cases, 70% or more of all rect- son why is that the main objective of the taxation heuristics angles should be expected to be horizontal, with a gradual is to result in grid-like layouts, and the only instances when it transition to perfect orientation for near uniform distributions.

25 1024 1024 2 1 Also, it might be interesting to notice the strip between 1 and 512 512

1.9 0.9 256 256 4 where deep red loci are found. These are not random, but 1.8 0.8 128 128 rather the same regions where Eat the Rich failed in regard 1.7 0.7 64 64

1.6 0.6 to orientation due the small nodes having too little value and 32 32

16 1.5 16 0.5 being too few in number to stack horizontally, regardless of Variance Variance 8 1.4 8 0.4 how much width was taken from the largest node. 4 1.3 4 0.3 2 1.2 2 0.2 Orientation (figures: 42b, 43b and 44b) 1 1 1.1 0.1

0.5 0.5 Due to the algorithm having a higher success rate at making 1 0

0.25 0.25 0 10 20 30 40 0 10 20 30 40 layout improvements through increase of target aspect ratio, Mean Mean Welfare performed best in regards to orientation. With the (a) Inverse weighted mean offset (b) Orientation. exception of low variance quotient of aspect ratio. Welfare offers significantly improved results in regards to ori- Figure 42. Welfare for normally distributed data. entation even when compared to Subsidy. The long strips of mediocre results around 0.5 have been reduced to dots, and

1024 1024 the rest or that area now exhibits up to 80% horizontal orien- 1 0

512 512 0.9 −0.1 tation. 256 256 0.8 −0.2 128 128 Compared to Squarify, Welfare can be expected to have up 0.7 −0.3 64 64 0.6 −0.4 75% more of its total nodes be horizontal, especially for the 32 32

0.5 −0.5 16 16

Variance Variance areas in which Squarify performs the worts. Overall, for most

0.4 −0.6 8 8 use-cases, 90% or more of all rectangles should be expected 4 0.3 4 −0.7 to be horizontal, with a gradual transition to perfect orienta- 2 0.2 2 −0.8

1 0.1 1 −0.9 tion for near uniform distributions.

0.5 0.5 0 −1

0.25 0.25 0 10 20 30 40 0 10 20 30 40

Mean Mean DISCUSSION In this section the results from the previous experiment along (a) Inverse weighted mean offset (b) Orientation. with further analysis based on those results shall be presented. quotient of aspect ratio.

Figure 43. Deterioration difference image for Welfare minus Squarify. Methodology Statistical significance of the first two experiments

1024 1024 0 1 The first two experiments are not meant to be statistically sig- 512 512 −0.1 0.9 nificant. But they are exceptions to what are assumed to be 256 256 −0.2 0.8 128 128 absolute rules. They are simple edge-cases meant to illustrate −0.3 0.7 64 64 the flaws with arithmetic mean of OAAR. −0.4 0.6 32 32

−0.5 0.5 16 16 Variance Variance Their purpose is not "prove" that FOAAR is a suitable metric −0.6 0.4 8 8 for evaluation of treemap tiling algorithms, but to highlight a 4 −0.7 4 0.3

2 −0.8 2 0.2 problem and offer a solution.

1 −0.9 1 0.1

0.5 0.5 −1 0 To actually prove the reasoning behind FOAAR would re-

0.25 0.25 0 10 20 30 40 0 10 20 30 40 quire a mathematical proof rather than anecdotal or statisti- Mean Mean cal evidence (if lets say, I made a Monte-Carlo variant of the (a) Inverse weighted mean offset (b) Orientation. experiment). quotient of aspect ratio. Experiment 1: An invisible outlier Figure 44. Improvement difference image for Welfare minus Squarify. The purpose of this experiment was instead to clearly illus- trate, through a easily replicable and transparent example, the shortcomings of current methodology in an exaggerated Welfare manner. The idea was to create a simple scenario where un- Since Welfare builds upon Eat the Rich it should be expected weighted mean of OAAR, the current practice, was guaran- to behave similarly. Nevertheless, it is expected to have worse teed to yield a conspicuous value that could not be argued to aspect ratios and better orientation. be representative of visual appearance. Aspect ratio (figures: 42a, 43a and 44a) It is an intentionally modest scenario to show how dispropor- Welfare elicits a large amount of areas of larger aspect ratios tionately low value nodes are represented by OAAR (see fig. that Eat the Rich. Just as with Subsidy these areas are a desir- 25b). There is no perceptually reasonable argument for which able trait. The only reason the algorithm did not default to Eat the node with the lowest are should have over 200 times more the Rich was because it managed to create a grid-like layout impact on the final aggregate that the node with the largest or improve the current one. In comparison to Subsidy there area. Especially, when the former is the most visible and the high value loci are much more frequent. latter is invisible due to sub-pixel resolution.

26 But bear in mind that it is not necessary for the node to be also happen to be the same ones that would not crash the test- extremely low in value. There is a mathematical skew in favor ing software. of all low value nodes, due to the an increasing rate of growth before and after 1. Continuing on the topic, lets address now why Squarify be- haves like no other algorithm in regards to mean OAAR. The solution suggested in this thesis, FOAAR, draws parallels Which is to say, an explanation as to why it manages to obtain from 3D rasterization techniques to solve this problem. Think excellent mean OAAR while having conspicuously offset as- of OAAR as a projection onto the Cartesian axis. Such a pro- pect ratios (see fig.28a, which should be a horizontal line at jection would cause cumulative distortion if the projected val- 1.5 for a perfect solution). There are two factors to this: ues are operated together, for instance through aggregation. This is known to be a problem for interpolation when there is 1. Squarify minimizes the OAAR of low value nodes. a depth butter [14]. Since at a fundamental level, aggregation 2. Squarify does not even attempt to achieve a perfect solu- is no much different from interpolation (especially weighted tion. 1 mean), and the aspect ratio is a quotient akin z . It was hy- pothesized that the same kind of methodology could yield fa- The first factor means that Squarify ensures that the smallest vorable results. So values are hence multiplicatively inversed nodes, the ones that can skew the result the worst, are kept (FOAAR), operated upon (aggregated), and then multiplica- low. It achieves this by repeatedly reducing height and width tively inversed once more. This was the inspiration behind through repeated removal of rows and columns, and since the FOAAR as a metric, and why it is recommended to invert it data is sorted in descending order it leaves the smallest nodes only after aggregation. for last. Hence it comes as no surprise that FOAAR exhibits a more This puts Squarify at great advantage when compared to any linear pattern of growth in figure 25a. The multiplicative in- algorithm that does not do this, but is entirely unrelated to verse of mean FOAAR is visually and numerically represen- visual appearance, Indeed, there is a baffling disconnect be- tative (tables 2 and even 3) even without weighting the aggre- tween visual and numeric representation, with the algorithm gates. being rewarded in terms of the aggregate metric for behaviour that at best is non-representative (the smallest nodes), and at Furthermore, since there is such a skew in favor of low value worst is not a visible part of the visualization. nodes, weighted average might not be enough to actually dis- tort values in favor of large and visible nodes as previous This visual disconnect is also the origin of the second prob- thought in literature Shneiderman and Wattenberg [16], Bed- lem: a perfect solution is assumed to the the same thing as erson et al. [3]. This also means that weighting is not as op- an orientation-agnostic perfect solution, which they visually tional as it has been thought to be in the literature. For aggre- are not. There has been such a focus on numeric values that gate metrics other than FOAAR or offset quotient it might be many glaring visual flaws have been largely ignored because a compulsory corrective measure. Otherwise there is no guar- they are not reflected by the numbers. antee that any visible nodes are represented by the aggregate. 1 For instance, OAAR does not differentiate between r and r ; but the human eye does, and there is no reason or justifica- Experiment 2: Squarify and target aspect ratio tion(see [6]) why rectangles in Squarify’s rows should aim The results for Experiment 2 show support for the claim that for 1 rather than r. If anything it is the only reason why the OAAR is only accurate as an aggregate metric when the target r algorithm fails to obtain perfect solutions with uniform data aspect ratio is 1. Otherwise, a perfect aggregate metric does distributions (see fig.45). not entail a perfect solution. What is worrying is that this particular data value distribution Monte-Carlo trials was taken from previous literature. It was not an isolated ex- It must be admitted that the methods in this thesis are unortho- ample, log normal distributions and exponential distributions dox to say the least. Nevertheless, they have been chosen with were also tried to the same effect, but ultimately Zipf without a purpose and full awareness of what is common practice in having to tune any parameters (in this case the default s = 1). literature. The above is probably a result of the problems that arise from A previous version of this thesis featured Monte-Carlo trials low value nodes and arithmetic mean of OAAR. These prob- akin those used by many previous authors [6, 16, 3, 9, 17, 7]. lem have, up to this point, intentionally been portrayed in this In spite of promising results, it was discovered that with that thesis as less hindering that they are in practice. After all, Ex- method it is possible to obtain almost whatever result are de- periment 1 was tailored to be moderate, the invisible node had sired by fine-tuning the parameters or the set-up of the ran- 0.17% of the total mass which is not particularly low for the dom sampling. It was even possible to obtain contradicting standards of a real data-set. Real data-sets can have several result. thousand leaves, grouped in a multitude of hierarchical lev- From a principle and logical perspective a scientifically valid els. Attempts to measure a real treemap (without any hacks, methodology should not be able to prove both something and such as filtering low value nodes or having minimum heights its opposite. and widths) with an algorithm other than Squarify will for the most part fail due numeric overflows. So it is not remarkable However, it is not that Monte-Carlo trials are fundamentally that the selected few data distributions used in comparisons flawed. After all, these test are replicable. It is just that in

27 0.538:1 0.538:1 0.538:1 0.538:1 0.538:1 1.50:1 1.50:1 4.00% 4.00% 4.00% 4.00% 4.00% 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 4.00% 4.00% 4.00% 4.00% 4.00% 4.00% 4.00% 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 4.00% 4.00% 1.22:1 0.734:1 0.734:1 0.734:1 4.00% 4.00% 4.00% 4.00% 4.00% 1.50:1 1.50:1 4.00% 4.00% 4.00% 4.00% 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 4.00% 4.00% 4.00% 4.00% 4.00% 4.00% 4.00% 1.22:1 0.412:1 0.412:1 1.50:1 1.50:1 4.00% 1.66:1 4.00% 4.00% 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 4.00% 4.00% 4.00% 4.00% 4.00% 4.00% 4.00% 4.00% 1.50:1 1.50:1 1.22:1 1.50:1 1.50:1 1.50:1 1.50:1 1.50:1 4.00% 1.66:1 4.00% 4.00% 4.00% 4.00% 4.00% 4.00% 4.00% 4.00% (a) Squarify (b) MEM-Squarify

Figure 45. Treemaps of uniform(a,b) a = 0 b = 25 a n < b n N . As it can be seen on these images, it is not the spikes phrasing [2] nor the Squarification (removing a{ row or column| based∧ on largest∧ ≤ side of the∧ remaining∈ } are) but the reliance on OAAR that prevents Squarify from yielding perfect solutions. The MEM version of Squarify can at no compromise obtain better aspect ratios and orientation. this particular case they hold little predictive power and are but it also has been shown to be a relevant factor for the pur- not extensive enough to make general claims. pose of interaction via Fitts Law [15]. On the other hand the visual cluster analysis does predict a multitude of use cases, and was for instance the way that that Experiment 3: comparison between Squarify and the it was found that MEM layouts approximate the prefect so- MEM algorithms lution as distributions become more uniform or that Squarify As elicited by the visual cluster analysis there are specific re- does not always succeed at squarification (fig. 22). gions were different algorithm perform better or worse in re- gard of aspect ratio and orientation. Based on these regions lets suggest use cases for the different algorithms. Orientation and aspect ratio Eat the Poor is suggested for most use cases, both in terms of Before discussing the results for experiment 3, lets go through aspect ratio and orientation. However there are some regions why orientation and aspect ratio are relevant as aggregate met- where Eat the Rich performs better. As a rule of thumb eat the rics. Esp what implications they have for real usage. rich should be used when there are large value differences in Orientation does not seem to have been widely acknowledged the data. Nevertheless, even in these instances Welfare could in literature. However when it is mentioned it is terms of be better suited for these use cases unless the orientation of whether or not it has significant perceptual effects [13]. In the nodes in the treemap is irrelevant (if an exact aspect ratio the literature, there seems to be an general eagerness, towards is important the maxOffset of welfare can be reduced). Sub- treating OAAR as the only existing definition of aspect ratio. sidy, does not benefit as much from Taxation as welfare does, But lets not forget that as an orientation agnostic metric, it ac- and it ends up being a compromise between aspect ratio and tually contains less information. While mathematically this is orientation, but it could potentially be used in the same use useful, the lost information is visually significative. Namely, cases as Eat the Poor with a low maxOffset solely to prevent which is the long side of the rectangle. a line like last columns. The main reason orientation is important is not only because of the potential area estimation error, but also because of prac- FUTURE RESEARCH tical reasons. A consistent, horizontal orientation, is conve- In this section ideas for future development on the subject of nient for many applications from labeling to animation, from treemap tiling algorithms are suggested. interaction to aesthetics. Evaluation Of the above the most prominent reason is perhaps labeling. Let start with the most important recommendation: in the fu- Treemaps are for the most part labeled, and maximizing hori- ture, there should be user testing and perceptual studies com- zontal width so that the text can be written horizontally and in paring treemap tiling algorithms. a legible font-size is of the utmost importance. Let it be kept in mind that information visualization is about presenting in- Within the subject of tree-map tiling algorithms there has so formation to the user and not maximizing evaluation metrics. far been an excessive focus on numerical values rather than the visual aspect. Hence there has grown a disconnect be- That being said, non-extreme aspect ratio values are impor- tween potentially flawed mathematical heuristics for evalua- tant both as evaluation metric and to the user. Not only does a tion and what is perceptually optimal or would be valued by non-extreme aspect ratio contribute towards legibility[10, 13] an user.

28 Squarify more intuitive numeric values for FOAAR, aggregate metrics MEM-Squarify, a non-orientation-agnostic version of Squar- can be multiplicatively inversed after aggregation. ify, seems to (at least for uniform distributions) be able to However, in order to compensate for the loss of information obtain better aspect ratios and orientation than the original when using orientation-agnostic metrics, the quantitative met- implementation. It would be interesting to compare the two ric form of orientation can be used. It is simple to calculate, using visual cluster analysis and see if the improvements are unbiased and yields representative aggregates. more general than that. For evaluation of treemap tiling algorithms with a target as- Metrics pect ratio, the generalized forms of orientation-agnostic as- Hyperbolic coordinates should be examined as an alternative pect ratio (OAAR) and its multiplicative inverse (FOAAR) to the existing metrics. As mentioned in the method section, should be used. These forms which have been given the name this could potentially be the mathematically ideal approach. offset factor and offset ratio ensure a perfect value if and only However, there is risk that these metrics will not as intuitive if all the nodes in the treemap have the target aspect ratio. or easy to use as the one proposed in this paper. In terms of tiling algorithm and heuristics, MEM algorithms Algorithms were shown to result in improved aspect ratios and orienta- It makes little sense to have Eat the Poor, Eat the Rich, Sub- tion in comparison to Squarify (Experiment 3). Eat the Poor sidy and Welfare all be separate functions when the same is suggested for most use cases, although if orientation is of functionality could be implemented as a single function with the utmost importance Welfare provides the best results in additional arguments (one to enable squishing). Or even bet- that regard. Eat the Rich is best reserved for those few occa- ter through functional composition. sions where there are vast differences in value between data the largest elements and the rest. Finally, Subsidy offers a However, this not only applies to the MEM algorithms, but to happy compromise in terms of aspect ratios and orientation all greedy tiling algorithms. Based on the ideas of Baudel and between Eat the Poor and Welfare. Broeksema [2] it would be feasible to create a universal mod- ular configurable tiling algorithm that could yield a MEM lay- Acknowledgments out just as easily as a Squarify or a Strip layout. Furthermore, The author would like to thank Professor Mario Romero Vega all the different parameter combinations would give raise to from the KTH Royal Institute of Technology for all the sup- countless new tiling algorithms. port and encouragement provided. Heuristics Additional resources In terms of heuristics there is still much room for expansion. Additional resources, such as interactive visualizations, For instance, there exists an alternative to the Taxation heuris- demonstrations, source code and information can be found tic, Move back, that was not included as part of the thesis. at: www.memtreemaps.eu Instead of recalculating the entire layout when the last row is Squished, Move back only recalculates the last two columns and merges them together into one. References Amazon.com. Amazon Mechanical Turk - Welcome, 2017. However, in the long term, it should not be about individual URL https://www.mturk.com/mturk/welcome. Accessed on: heuristics, but about smart tiling algorithms. 2017-06-03. Theoretically, it should be possible to create a system that au- Thomas Baudel and Bertjan Broeksema. Capturing the de- tomatically selects the best possible algorithm in terms of a sign space of sequential space-filling layouts. IEEE Trans- specified metric. A tiling algorithm would be selected, not actions on Visualization and , 18(12): for each level, as mixed treemaps currently do, but for each 2593–2602, 2012. node. There is no inherent reason why the criterion for chang- ing the tiling algorithm should be node depth alone; an arbi- Benjamin B Bederson, , and Martin Wat- trary function that takes in a parent node and returns a tiling tenberg. Ordered and quantum treemaps: Making effective algorithm could be used. This function could use the value use of 2d space to display . AcM Transactions on distribution of the children nodes to determine the optimal Graphics (TOG), 21(4):833–854, 2002. tiling algorithm to use. Michael Bostock. d3-scale: Encodings that CONCLUSION map abstract data to visual representation, May Evaluation metrics and tiling algorithms were analyzed theo- 2017. URL https://github.com/d3/d3-scale/tree/ retically and experimentally. 4c8c282d5f0ac938b4841ce6851389e7f0f545ba. Accessed on: 2017-05-26. Through the experiments, it was shown that mean orientation- agnostic aspect ratio (OAAR) is an unreliable aggregate met- Michael Bostock. d3/d3-, 2017. ric that potentially results in non-representative results (Ex- URL https://github.com/d3/d3-hierarchy/tree/ periment 1), and false positives (Experiment 2). Its mul- 3e7f9d99ec5c5cc1d85723908407de57b10675eb#treemap_tile. tiplicative inverse (FOAAR) is recommended instead. For Accessed on: 2017-05-09.

29 Mark Bruls, Kees Huizing, and Jarke J Van Wijk. Squar- ified treemaps. In 2000, pages 33–42. Springer, 2000. Antonio Cesarano, FIlomena Ferrucci, and Mario Torre. A heuristic extending the Squarified treemapping algorithm. arXiv:1609.00754 [cs], September 2016. URL http://arxiv. org/abs/1609.00754. arXiv: 1609.00754. William S Cleveland and Robert McGill. Graphical percep- tion: Theory, experimentation, and application to the devel- opment of graphical methods. Journal of the American sta- tistical association, 79(387):531–554, 1984. Björn Engdahl. Ordered and unordered treemap algorithms and their applications on handheld devices. Masters Degree Project, Stockholm, Sweden, 2005. Jeffrey Heer and Michael Bostock. Crowdsourcing graphi- cal perception: using mechanical turk to assess visualization design. In Proceedings of the SIGCHI Conference on Hu- man Factors in Systems, pages 203–212. ACM, 2010. Brian Johnson and Ben Shneiderman. Tree-Maps: A Space- filling Approach to the Visualization of Hierarchical Infor- mation Structures. In Proceedings of the 2Nd Conference on Visualization ’91, VIS ’91, pages 284–291, Los Alami- tos, CA, USA, 1991. IEEE Computer Society Press. ISBN 978-0-8186-2245-8. URL http://dl.acm.org/citation.cfm? id=949607.949654. N. Kokash, B. de Bono, and J. Kok. Template-based treemaps to preserve spatial constraints. In 2014 Interna- tional Conference on Information Visualization Theory and Applications (IVAPP), pages 39–49, January 2014. Nicholas Kong, Jeffrey Heer, and Maneesh Agrawala. Per- ceptual guidelines for creating rectangular treemaps. IEEE transactions on visualization and computer graphics, 16(6): 990–998, 2010. Kok-Lim Low. Perspective-correct interpolation. 2002. I Scott MacKenzie and William Buxton. Extending fitts’ law to two-dimensional tasks. In Proceedings of the SIGCHI conference on Human factors in computing systems, pages 219–226. ACM, 1992. Ben Shneiderman and Martin Wattenberg. Ordered treemap layouts. In Proceedings of the IEEE Symposium on Informa- tion Visualization 2001, volume 73078, 2001. Ying Tu and Han-Wei Shen. Visualizing changes of hierar- chical data using treemaps. IEEE Transactions on Visualiza- tion and Computer Graphics, 13(6):1286–1293, 2007. Christopher W Tyler. Paradoxical perception of surfaces in the shepard tabletop illusion. i-Perception, 2(2):137–141, 2011. Roel Vliegen, Jarke J Van Wijk, et al. Visualizing business data with generalized treemaps. IEEE Transactions on Visu- alization and Computer Graphics, 12(5):789–796, 2006.

30 Appendices

SQUARIFY Squarify performance for normally distributed data.

Inverse weighted mean offset quotient of aspect ratio.

1024 2 512

1.9 256

1.8 128

1.7 64

1.6 32

16 1.5 Variance

8 1.4

4 1.3

2 1.2

1 1.1

0.5 1

0.25 0 10 20 30 40

Mean

31 Orientation

1024 1 512

0.9 256

0.8 128

0.7 64

0.6 32

16 0.5 Variance

8 0.4

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

32 Negative difference of Squarify minus Squarify. As a sanity check, these should be blank.

Inverse weighted mean offset quotient of aspect ratio.

1024 1

512 0.9

256 0.8 128 0.7 64

0.6 32

0.5 16 Variance

0.4 8

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

33 Orientation

1024 0

512 −0.1

256 −0.2 128 −0.3 64

−0.4 32

−0.5 16 Variance

−0.6 8

4 −0.7

2 −0.8

1 −0.9

0.5 −1

0.25 0 10 20 30 40

Mean

34 Positive difference of Squarify minus Squarify. As a sanity check, these should be blank.

Inverse weighted mean offset quotient of aspect ratio.

1024 0

512 −0.1

256 −0.2 128 −0.3 64

−0.4 32

−0.5 16 Variance

−0.6 8

4 −0.7

2 −0.8

1 −0.9

0.5 −1

0.25 0 10 20 30 40

Mean

35 Orientation

1024 1

512 0.9

256 0.8 128 0.7 64

0.6 32

0.5 16 Variance

0.4 8

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

36 EAT THE POOR Eat the Poor for normally distributed data.

Inverse weighted mean offset quotient of aspect ratio.

1024 2 512

1.9 256

1.8 128

1.7 64

1.6 32

16 1.5 Variance

8 1.4

4 1.3

2 1.2

1 1.1

0.5 1

0.25 0 10 20 30 40

Mean

37 Orientation

1024 1 512

0.9 256

0.8 128

0.7 64

0.6 32

16 0.5 Variance

8 0.4

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

38 Deterioration difference image for Eat the Poor minus Squarify.

Inverse weighted mean offset quotient of aspect ratio.

1024 1

512 0.9

256 0.8 128 0.7 64

0.6 32

0.5 16 Variance

0.4 8

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

39 Orientation

1024 0

512 −0.1

256 −0.2 128 −0.3 64

−0.4 32

−0.5 16 Variance

−0.6 8

4 −0.7

2 −0.8

1 −0.9

0.5 −1

0.25 0 10 20 30 40

Mean

40 Improvement difference image for Eat the Poor minus Squarify.

Inverse weighted mean offset quotient of aspect ratio.

1024 0

512 −0.1

256 −0.2 128 −0.3 64

−0.4 32

−0.5 16 Variance

−0.6 8

4 −0.7

2 −0.8

1 −0.9

0.5 −1

0.25 0 10 20 30 40

Mean

41 Orientation

1024 1

512 0.9

256 0.8 128 0.7 64

0.6 32

0.5 16 Variance

0.4 8

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

42 EAT THE RICH Eat the Rich for normally distributed data.

Inverse weighted mean offset quotient of aspect ratio.

1024 2 512

1.9 256

1.8 128

1.7 64

1.6 32

16 1.5 Variance

8 1.4

4 1.3

2 1.2

1 1.1

0.5 1

0.25 0 10 20 30 40

Mean

43 Orientation

1024 1 512

0.9 256

0.8 128

0.7 64

0.6 32

16 0.5 Variance

8 0.4

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

44 Deterioration difference image for Eat the Rich minus Squarify.

Inverse weighted mean offset quotient of aspect ratio.

1024 1

512 0.9

256 0.8 128 0.7 64

0.6 32

0.5 16 Variance

0.4 8

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

45 Orientation

1024 0

512 −0.1

256 −0.2 128 −0.3 64

−0.4 32

−0.5 16 Variance

−0.6 8

4 −0.7

2 −0.8

1 −0.9

0.5 −1

0.25 0 10 20 30 40

Mean

46 Improvement difference image for Eat the Rich minus Squarify.

Inverse weighted mean offset quotient of aspect ratio.

1024 0

512 −0.1

256 −0.2 128 −0.3 64

−0.4 32

−0.5 16 Variance

−0.6 8

4 −0.7

2 −0.8

1 −0.9

0.5 −1

0.25 0 10 20 30 40

Mean

47 Orientation

1024 1

512 0.9

256 0.8 128 0.7 64

0.6 32

0.5 16 Variance

0.4 8

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

48 SUBSIDY Subsidy for normally distributed data.

Inverse weighted mean offset quotient of aspect ratio.

1024 2 512

1.9 256

1.8 128

1.7 64

1.6 32

16 1.5 Variance

8 1.4

4 1.3

2 1.2

1 1.1

0.5 1

0.25 0 10 20 30 40

Mean

49 Orientation

1024 1 512

0.9 256

0.8 128

0.7 64

0.6 32

16 0.5 Variance

8 0.4

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

50 Deterioration difference image for Subsidy minus Squarify.

Inverse weighted mean offset quotient of aspect ratio.

1024 1

512 0.9

256 0.8 128 0.7 64

0.6 32

0.5 16 Variance

0.4 8

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

51 Orientation

1024 0

512 −0.1

256 −0.2 128 −0.3 64

−0.4 32

−0.5 16 Variance

−0.6 8

4 −0.7

2 −0.8

1 −0.9

0.5 −1

0.25 0 10 20 30 40

Mean

52 Improvement difference image for Subsidy minus Squarify.

Inverse weighted mean offset quotient of aspect ratio.

1024 0

512 −0.1

256 −0.2 128 −0.3 64

−0.4 32

−0.5 16 Variance

−0.6 8

4 −0.7

2 −0.8

1 −0.9

0.5 −1

0.25 0 10 20 30 40

Mean

53 Orientation

1024 1

512 0.9

256 0.8 128 0.7 64

0.6 32

0.5 16 Variance

0.4 8

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

54 WELFARE Welfare for normally distributed data.

Inverse weighted mean offset quotient of aspect ratio.

1024 2 512

1.9 256

1.8 128

1.7 64

1.6 32

16 1.5 Variance

8 1.4

4 1.3

2 1.2

1 1.1

0.5 1

0.25 0 10 20 30 40

Mean

55 Orientation

1024 1 512

0.9 256

0.8 128

0.7 64

0.6 32

16 0.5 Variance

8 0.4

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

56 Deterioration difference image for Welfare minus Squarify.

Inverse weighted mean offset quotient of aspect ratio.

1024 1

512 0.9

256 0.8 128 0.7 64

0.6 32

0.5 16 Variance

0.4 8

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

57 Orientation

1024 0

512 −0.1

256 −0.2 128 −0.3 64

−0.4 32

−0.5 16 Variance

−0.6 8

4 −0.7

2 −0.8

1 −0.9

0.5 −1

0.25 0 10 20 30 40

Mean

58 Improvement difference image for Welfare minus Squarify.

Inverse weighted mean offset quotient of aspect ratio.

1024 0

512 −0.1

256 −0.2 128 −0.3 64

−0.4 32

−0.5 16 Variance

−0.6 8

4 −0.7

2 −0.8

1 −0.9

0.5 −1

0.25 0 10 20 30 40

Mean

59 Orientation

1024 1

512 0.9

256 0.8 128 0.7 64

0.6 32

0.5 16 Variance

0.4 8

4 0.3

2 0.2

1 0.1

0.5 0

0.25 0 10 20 30 40

Mean

60