ISRN Artificial Intelligence

Volume 2012, Article ID 139603, 10 pages

http://dx.doi.org/10.5402/2012/139603

## Evolutionary Computation for Label Layout on Unused Space of Stacked Graphs

^{1}DHCJAC, Ritsumeikan University, Kuatsu, Shiga 525-877, Japan^{2}ISE, Ritsumeikan University, Kuatsu, Shiga 525-877, Japan

Received 22 November 2011; Accepted 22 December 2011

Academic Editors: W. Lam and C. Nikou

Copyright © 2012 Alejandro Toledo et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

Placing numerous objects and their corresponding labels in the stacked graph visualization is a challenging problem. In the stacked graph, different combinations of initial parameters and filtering effects yield views with hidden information, illegible labels, and unused space. The result is a tool that does not take advantage on the unused space to reveal information to the user for further investigation. We present an automatic method for label layout on the unused space in a stacked graph. An evolutionary computation (EC) is used to optimize the best label position according to legibility requirements, as well as requirements for keeping semantic relationships between labels and their representative visual objects. A number of EC experiments, as well as a usability study on label legibility, show that our proposed solution looks promising, as compared to the traditional solutions.

#### 1. Introduction

Designing effective information visualization systems with abundant associated labels is a difficult task, especially when the screen space is limited. Label layout is an essential task in the field of information visualization to identify the visualized data and different visual objects. The challenge is to find a global labeling solution without any overlapping of other labels. Since labels are used to explain the data, the solution is reduced not only to minimize the overlapping, but also to keep semantic relationships between labels and their corresponding visual objects. The label layout problem, which is proved to be NP-hard, has been extensively studied. In cartographic design, for instance, label legibility is the most important requirement [1].

#### 2. Related Work

In this paper, we use and extend the stacked graph visualization as proposed in [2, 3], where a collection of job occupations is visualized using stripes representing occupation’s time series (Figure 1). Since the data values are normalized, the heights of individual stripes add up to the height of the overall graph; thus, there can be no spaces between the stripes because this would distort their sum. In the case of stacked graphs with many occupations, this may cause the individual stripes to be harder to read. The legibility of the data is, indeed, an unsolved design consideration of the stacked graph [4].

Colors have been used to distinguish stripes without using heavy borders [2]. Another proposed solution in [2] is to use a threshold for label visibility (TLV), which is the minimum width, in pixels, for a stripe to receive a label. However, in a previous experiment [5], we found that the TLV makes no significant improvement on data legibility. Moreover, as for the obtained results, the lack of labels on some of the stripes was the main reason they found on the stacked graph illegibility. In this work, we use the TLV to compare our proposed system with two versions of the traditional stacked graph.

Maximizing the display of data content in a comprehensible way is a problem that has been addressed by many researchers. Li et al. [6] implemented a set of techniques in LifeLines, a visualization environment as applied to medical patient records. The authors presented algorithms and metrics based on map-oriented techniques.

Text labels either overlay visual objects or placed outside (internal versus external labels). Works supporting the idea to use “call-outs”or “leaders” connecting external labels to visual objects can be found on hand-made illustrations, as in [7, 8], or for labeling server motherboards, as in [9].

Works on aesthetic layouts to support the legibility of stacked graphs can be found in [4, 10]. Here, the author’s proposal is on the use of different shapes or stripes, as well as coloring. Hartman et al. [11] developed a similar idea with the use of external labels.

Studies on labeling and label legibility have been conducted to support information visualizations. Talbot et al. [12] extended Wilkinsons optimization approach to produce labelings on axis in a two-dimensional graph. Luboschik et al. [13] present a labeling method using fast point-feature, to support information visualization systems. An interesting experiment on label readability can also be found in [14], where the authors investigated the readability of medication labels. The contributions of this paper are (i) a new component, based on evolutionary computation, for augmenting the readability of labels in the stacked graph visualization, (ii) an adjustment to the PMX crossover operator for permutation of label positions, (iii) an adjustment to the SWAP mutation operator for replacement of label positions, and (iv) a usability study on label legibility proving the effectiveness of our method.

#### 3. Evolutionary Computation Design

Using a grid layout, the visualization area is divided into a collection of equal partitions. The center point of each partition is the actual absolute position. Each partition has a unique identifier, and those not intersecting with the stacked area—in the unused space—are considered as the candidate partitions. Figure 2 shows the partitions obtained from the stacked graph of Figure 1. A grid layout (5 rows and 8 columns) was used; leading to 16 candidate partitions (circles colored blue). To support a more efficient solution encoding, candidate partitions are reindexed, for example, in Figure 2 from 0 to 15.

##### 3.1. Chromosome Encoding

We encode a label layout design in one chromosome, using variable-length, fixed-order binary encoding. Given a set of illegible labels , and a set of candidate partitions , a chromosome (Table 1) is produced using genes. Under this representation, each gene consists of bits indicating the candidate partition for positioning the corresponding label. We define using the following recurrence: Here, denotes a locus encoding a partial gene evaluation.

The evaluation of the th gene for the candidate label will then yield a partition, upon which positioning on the unused space. Therefore, all partitions derived from the complete chromosome characterize a label layout for all selected illegible labels.

As an example, consider two layouts represented by the following two chromosomes, where six labels are to be placed on the unused space of the stacked graph of Figure 1, using the partitions of Figure 2:

Chromosome A: | 0000 | 0110 | 0010 | 1000 | 0111 | 1001 |

Chromosome B: | 1001 | 0101 | 0110 | 0011 | 0001 | 0010 |

Our approach is similar to several proposed GAs for reordering or permutation problems. The most famous is the traveling salesman problem (TSP) in which a salesman wants to visit a number of cities while traveling the least possible distance. In the TSP, each city must be represented once and only once; and the fitness of the chromosome is related to the tour length, which in turn depends on the ordering of the cities. Our solution is comparable to the TSP in the encoding method, that is, we prefer partitions to be represented once and only once in the chromosome. This is because their repetitions would lead to overlapping, and thus infeasible solutions. Our label layout problem and TSP differ, however, in the number of encoded elements. In the TSP, all cities are represented in a chromosome, while our solution encodes only a subset of the candidate partitions. This will require an adjustment of the crossover and mutation operators designed for the TSP, which we describe later in the following sections.

##### 3.2. Fitness Function

We decided that the quality of label layout depends on the fitness of candidate partitions for the illegible labels. We enforce appropriate label arrangements on the unused space using the following criteria:

: Minimize the overlapping between labels,

: Maximize the correlation between the label order and the stripe order.

The fitness value for for individual is inversely proportional to the number of labels with overlapping: where is the number of labels, of individual , with overlapping. Here, two labels are overlapped if the intersection between their bounding boxes is greater than zero.

The fitness value for is proportional to the correlation between the label order and stripe order. For each individual , we calculate two tuples. A tuple of partition positions () is obtained from the absolute -coordinates of the encoded partitions, and a tuple of stripe positions () is the order of the illegible labels under consideration in the current stacked graph. The two tuples are used to reward a correlation ratio between the label order and the stripe order using the following equation: where denotes the Pearson product moment correlation coefficient. Note that . Finally, the total fitness value for indivual is obtained as where is a weighting ratio for criterion .

##### 3.3. Genetic Algorithm and Genetic Operators

We used the following genetic algorithm.(1)Create an initial population of chromosomes (generation 0)(2)Evaluate the fitness of each chromosome(3)Select the fittest chromosome(4)Excluding the chromosome selected in step 3, select parents from the current population via roulette wheel selector(5)Choose at random a pair of parents for mating. Apply crossover operator(6)Process each offspring by the mutation operator, and insert the new offspring into the new population(7)Repeat steps 5 and 6 until offsprings are created(8)Replace the old population of chromosomes with the new population(9)Add the chromosome selected in step 3 into the new population(10)Evaluate the fitness of each chromosome in the new population(11) Increase the generation number and go back to step 3 if this number is less than some upper bound.

The above algorithm introduces concepts such as crossover and mutation operator. In this work we used the following four operators.

*(1) Single Point Crossover (C1).*

The single point crossover operator is aimed at exchanging bit strings between two parent chromosomes. A random position between 1 and is chosen along the two parent chromosomes, where is the chromosome’s length. Then, the chromosomes are cut at the selected position, and their end parts are exchanged to create two offspring. For instance, the two chromosomes of the previous section are selected to produce two offspring as follows.

parent : | offspring : |

parent : | offspring : |

It should be noted that single-point crossover cannot guarantee representations with no repeated values.

*(2) Partially Matched Crossover, PMX, (C2).*

PMX [15] arose in considering ways to tackle issues associated with the classic traveling salesman problem (TSP). Given two parents and , PMX randomly picks two crossover points. The offspring is then constructed in the following way. Starting with a copy of , the positions between the crossover points are, one by one, set to the values of in these positions. To keep the string a valid chromosome, the cities in this positions are not just overwritten. To set position to city , the city in position and city swap positions. Consider the example below of this encoding for the two tours : and : .

swap 4 and 1 | swap 3 and 4 | no change | first offspring |

↑ | ↑ | ↑ | |

5241376 | 5241376 | ||

6234175 | 6234175 | ||

↓ | ↓ | ↓ | |

swap 4 and 1 | swap 1 and 3 | no change | second offspring |

Since TSP chromosomes encode all cities, the city in position and city can always be exchanged, for example, cities and could be found in the copies of and , respectively. In our domain, however, a partition in position cannot always find its pair within the same parent. So, we propose to solve this by replacing such partition with the one in position in the other parent. Consider the example below of this encoding for the two chromosomes : and : .

swap 6 and 2 | replace 8 with 3 | first offspring |

↑ | ↑ | |

↓ | ↓ | |

swap 6 and 2 | replace 3 with 8 | second offspring |

*(3) Simple Mutation (M1).*

The bits of the two offspring generated by the crossover operator are then processed by the mutation operator. This operator is applied to each bit with a small probability (e.g., 0.001). When it is applied at a given position, the new bit value switches from 0 to 1 or from 1 to 0. Here, it should also be noted that the simple mutation operator cannot guarantee representations with no repeated values.

*(4) Swap Mutation (M2).*

Mutation operators for the TSP are aimed at randomly generating new permutation of cities. As opposed to the simple mutation operator, which introduces small perturbations into the chromosome, the permutation operators for the TSP often greatly modifies the original tour. One example is the swap mutation operator, where two cities are selected and swapped (i.e., their positions are exchanged). Since TSP chromosomes encode all cities, the selection of two of them is always possible. In our domain, however, there may be cases where this is not possible. Here, as part of our second adjustment, we propose to perform this selection by choosing one partition from the chromosome, and the other from the set of candidate partitions . The latter is randomly selected until a chromosome with no repeated values can be formed. Then, this partition replaces the one in the chromosome.

#### 4. Experiments

Aiming at solving the overlapping problem among labels (), our goal here was to compare the performance of the four combinations C1M1, C1M2, C2M1, and C2M2, all in terms of the time required to find a solution and the quality of the solution obtained. In order to be fair to the four operators, as well as to be thorough in our experiment, we compared the results among combinations using scaled problems through the use of different grid layout resolutions.

##### 4.1. Experimental Setup

We selected 25 illegible labels describing job occupation names from the view of Figure 1. The illegibility criterion was based on font size, where the smaller the font size, the most illegible the label. These labels have different lengths and, thus, different bounding boxes. To improve their legibility, we increased by the base minimum size of each label. We also used five different grid layouts for partitioning the visualization area, , , , , and ; leading to 34, 49, 71, 97, and 134 candidate partitions, respectively. As for crossover operators, we used single point (C1) and the adjusted PMX crossover (C2), both using a crossover rate of 0.6. As for mutation operators, we used simple (M1) and the adjusted swap mutation (M2), both using a mutation rate of . Finally, we used the following five different values for (population size): 25,50,75,100,125.

All candidate partitions, genetic operators (C1, C2, M1, M2), and population sizes were combined to produce 100 types of parameter selections for running the genetic algorithm. We call each type a “configuration.” Thus, for this experiment, we have the configuration tuples (conf1,34,C1,M1,25),…, (conf4,34,C2,M2,25),…, and (conf100,134,C2,M2,125). To produce a fair comparison among configurations, we reuse populations and create new ones at given intervals. Since populations can be reused only for tuples with the same number of candidate partitions, a new random initial population is created when the configuration number is a multiple of 4, otherwise, it is reused. Finally, each configuration was run using 500 generations, and all reported values are the results of 10 independent runs.

##### 4.2. Results

Two metrics were used to measure the results.(1)Quality of Solutions () : Fitness value obtained at generation 500. : Difference between and the initial fitness value.(2)Convergence Speed (): Best-fitness average of all generations [16]: Difference between and the initial fitness value.

Since we have different initial fitness values (25 in total), and will let us know the quality and convergence speed, respectively, of the solutions with respect to the evolution of populations.

In terms of , the best configuration was obtained from a grid layout of (71 candidate partitions), population size of 50 individuals, adjusted PMX crossover (C2), and adjusted SWAP mutation (M2); with a fitness average of , as shown in Table 2.

In terms of , the best configuration was obtained from a grid layout of (97 candidate partitions), population size of 25 individuals, adjusted PMX crossover (C2), and adjusted SWAP mutation (M2); with an improvement of .

In terms of both and , the best configuration was obtained from a grid layout of (71 candidate partitions), population size of 125 individuals, adjusted PMX crossover (C2), and adjusted SWAP mutation (M2); with a convergence speed and .

Our results show that our proposed operators, in this domain, outperform the standard ones. Also, as from our observations of the second and the third best results, the combination C2M2 outperforms, of the time, the other two operators. Another observation is that our best results of C2M2 were concentrated on configurations sharing the grid layout (71 candidate partitions). This suggests that our proposed method has no significant improvement by increasing the number of candidate partitions. Since we were also interested in the time required to obtain the best solution, we also observed the convergence speeds of our proposed method. Here, the convergence speed of the best , , is the third best convergence speed. Moreover, it has no significant difference with the best convergence speed . This number is associated to the group of 71 candidate partitions () and was also obtained from the combination C2M2. In general, this can be explained by the variations in the number of individuals , which confirms previous results, such as those of De Jong test functions [16].

Figure 3 shows the performance comparison among C1M1, C2M2, C2M2, and C2M2. Best fitness value versus generation number is plotted for all configurations. The experiment has been repeated 10 times to plot average values, using different maximum generation numbers. Because of space limitations, the plots for only the best , , , and are given.

Figure 4 shows contour plots, where the best results for the three variables (i) populations size, (ii) candidate partitions, and (iii) fitness value, are shown. It can be observed that where M2 is used, better fitness values are obtained, and also lower numbers of individuals are required, which suggests better computational performance. Moreover, where the combination C2M2 was used, the best fitness values were obtained.

Figure 5 shows stacked graph views produced by our genetic algorithm. Figure 5(a) show the result of experiment 3 d), as applied to Figure 1, where the weights was used. Figure 5(b) and Figure 5(c) show the results of views with prefixes “C” and “F”, respectively.

#### 5. Usability Study

We conducted a usability study with 30 subjects to investigate the readability of labels using 9 views extracted from 3 different versions of the stacked graph visualization. Our goal here was to compare the performance of the three versions, all in terms of subject reading speeds, as well as subject accuracy.

##### 5.1. Subjects

Participants in this study were computer science students taking courses at our university and consisting of 23 undergraduate students and 7 graduate students with the average age of 22.17, ranging from 20 to 26 years old. All subjects were selected from a test on stacked graph usage using a questionnaire for visual tasks [17]. The scores obtained from the task were used to divide the subjects into three groups; where each group contains 4 subjects with high score, 3 with score average, and 3 with low score. To avoid bias from ordering effects, each subject group was tested using different version orderings.

##### 5.2. Material

The materials used were as follows.(I)Three versions of the stacked graph visualization. One version (V1) with TLV = 12 (threshold for label visibility), another version (V2) with TLV = 0, and our proposed system (V3).(II)Nine views obtained from the three aforementioned versions; three views from each version, from which the first group, view_a, corresponds to the views with prefix “A” Figure 5(a), the second group, view_c, to the prefix “C” Figure 5(b), and the third group, view_f, to the prefix “F” Figure 5(c).(III)Twenty five illegible labels for each prefix, with variations in their font size.

##### 5.3. Design

The study was a 3 (stacked graph version) × 3 (version orderings) × 3 (view prefix) mixed-model design. The between-subject factor was version ordering (V1V2V3, V2V3V1, V3V1V2), and the within-subject factor was view prefix (view_a, view_c, view_f).

##### 5.4. Procedure

We prepared a task involved in searching, using the features of the visualization system, for labels with different levels of legibility. Six labels, describing occupation names, were to be found using the mouse hovering feature of the stacked graph, where an information box was shown to the subjects while they were moving the mouse on the visualization area. For this experiment, subjects could see in the information box both the searched label and its corresponding population number; as shown in the views of Figure 5. In the beginning, each participant was given a questionnaire containing the question “*what is the population number for each of the following occupation names?*” and six occupation names, sorted from easy to difficult in terms of legibility. Subjects had a limited time of one minute to write their answers.

##### 5.5. Results

A 3 (stacked graph version) × 3 (version ordering) × 3 (view prefix) mixed model analysis of variance was performed on the reading speed data and indicated significant main effects among stacked graph versions and view prefixes.

Speed tests indicate that V1 and V2 required significantly more time to read than V3 (). Similarly, subject error data indicated significant main effects among stacked graph versions. Accuracy tests indicated that more errors were committed with V1 and V2 than with V3 ().

A similar ANOVA of speed test indicated significant main effects among view prefixes when V2 is used (), that is, with this version some views will require lower time to read, but with some views, longer time. Here, we hypothesize that subjects, on some views, were able to find answers even if labels were overlapped. On the other hand, the same test indicated that there are no significant differences among view prefixes when V1 and V3 are used (). That is, if V1 is used, longer time will be required to find labels. If V3 is used, however, users will require significantly lower time to find them.

Interestingly, a similar ANOVA of subject accuracy showed an equivalent result as those in the previous paragraph. Subject error data indicated significant main effects among view prefixes when V2 is used (), that is, with this version, the accuracy of users in their findings will be moderately high only on some views. On the other hand, the same test indicated that there are no significant differences among view prefixes when V1 and V3 are used (). That is, if V1 is used, the accuracy of users will always be low. If V3 is used, however, users will show significantly high accuracy. Figure 6 shows a comparison results of the conducted usability study.

#### 6. Conclusions

In this paper, we intended to highlight the stacked graph as an interesting object of study. We have suggested an evolutionary computation for label layout on the unused space, where a method for maximizing the display of labels is proposed. An important purpose is to improve the legibility of the stacked graph by revealing to the users more information for further analysis. We developed a genetic algorithm which computes two fitness functions, one for solving the overlapping problem, and the other for keeping order correlations among labels and their corresponding visual objects. Our algorithm was inspired by previous solutions for ordering and permutation problems. Here, however, we adjusted two standard genetic operators in order to solve a similar problem in the stacked graph.

As for our usability study, our method proved to be successful. Our statistical analysis results, as well as our observations, showed that our stacked graph version outperformed the traditional ones. It is clear that solving the overlapping problem contributes to improve the legibility of the visualization, however, more investigation is needed to know how effective the correlation among labels and their visual objects are, as a semantic relationship, and useful for visual analysis tasks. For this, we believe that a different user experiment should be designed.

#### Acknowledgment

This work is supported by the MEXT Global COE Program-Digital Humanities Center for Japanese Arts and Cultures, Ritsumeikan University.

#### References

- J. Marks and S. Shieber, “The computational complexity of cartographic label placement,” Tech. Rep. TR-05-91, Center for Research in Computing Technology, Harvard University, 1991. View at Google Scholar
- J. Heer, F. B. Viégas, and M. Wattenberg, “Voyagers and voyeurs: supporting asynchronous collaborative visualization,”
*Communications of the ACM*, vol. 52, no. 1, pp. 87–97, 2009. View at Publisher · View at Google Scholar · View at Scopus - M. Wattenberg and J. Kriss, “Designing for social data analysis,”
*IEEE Transactions on Visualization and Computer Graphics*, vol. 12, no. 4, pp. 549–557, 2006. View at Publisher · View at Google Scholar · View at PubMed · View at Scopus - L. Byron and M. Wattenberg, “Stacked graphs—Geometry & aesthetics,”
*IEEE Transactions on Visualization and Computer Graphics*, vol. 14, no. 6, pp. 1245–1252, 2008. View at Publisher · View at Google Scholar · View at PubMed · View at Scopus - A. Toledo, K. Sookhanaphibarn, R. Thawonmas, and F. Rinaldo, “Personalized recommendation in interactive visual analysis of stacked graphs,”
*Journal of ISRN Artificial Intelligence*. In press. - J. Li, C. Plaisant, and B. Shneiderman, “Data object and label placement for information abundant visualizations,” in
*Proceedings of the 7th ACM International Conference on Information and knowledge Management—Workshop on New Paradigms in Information Visualization (NPIV '98)*, pp. 41–48, Bethesda, Md, USA, November 1998. - K. Ali, K. Hartmann, and T. Strothotte, “Label layout for interactive 3d illustrations,”
*Journal of the WSCG*, vol. 13, no. 1, pp. 1–8, 2005. View at Google Scholar - I. Vollick, D. Vogel, M. Agrawala, and A. Hertzmann, “Specifying label layout style by example,” in
*Proceedings of the 20th Annual ACM Symposium on User Interface Software and Technology (UIST '07)*, pp. 221–230, Newport, RI, USA, October 2007. View at Publisher · View at Google Scholar - C. C. Lin, “Crossing-free many-to-one boundary labeling with hyperleaders,” in
*Proceedings of the IEEE Pacific Visualization Symposium (PacificVis '10)*, pp. 185–192, March 2010. View at Publisher · View at Google Scholar · View at Scopus - S. Havre, E. Hetzler, P. Whitney, and L. Nowell, “ThemeRiver: visualizing thematic changes in large document collections,”
*IEEE Transactions on Visualization and Computer Graphics*, vol. 8, no. 1, pp. 9–20, 2002. View at Publisher · View at Google Scholar · View at Scopus - K. Hartmann, T. Gtzelmann, K. Ali, and T. Strothotte, “Metrics for functional and aesthetic label layouts,” in
*Smart Graphics*, A. Butz, B. Fisher, A. Krger, and P. Olivier, Eds., vol. 3638 of*Lecture Notes in Computer Science*, p. 924, Springer, Berlin, Germany, 2005. View at Google Scholar - J. Talbot, S. Lin, and P. Hanrahan, “An extension of Wilkinson's algorithm for positioning tick labels on axes,”
*IEEE Transactions on Visualization and Computer Graphics*, vol. 16, no. 6, pp. 1036–1043, 2010. View at Publisher · View at Google Scholar · View at PubMed · View at Scopus - M. Luboschik, H. Schumann, and H. Cords, “Particle-based labeling: fast point-feature labeling without obscuring other visual features,”
*IEEE Transactions on Visualization and Computer Graphics*, vol. 14, no. 6, pp. 1237–1244, 2008. View at Publisher · View at Google Scholar · View at PubMed · View at Scopus - J. A. A. Smither and C. C. Braun, “Readability of prescription drug labels by older and younger adults,”
*Journal of Clinical Psychology in Medical Settings*, vol. 1, no. 2, pp. 149–159, 1994. View at Publisher · View at Google Scholar · View at Scopus - D. Goldberg,
*Genetic Algorithms in Search, Optimization, and Machine Learning*, Addison-Wesley, 1989. - K. De Jong,
*Analysis of the behavior of a class of genetic adaptive systems*, Ph.D. dissertation, The University of Michigan, 1975. - A. Toledo, K. Sookhanaphibarn, R. Thawonmas, and F. Rinaldo, “Experimental evaluation of a stacked graph visualization,” in
*Proceedings of the Eurographics/IEEE Symposium on Visualization (EuroVis '10)*, Bordeaux, France, June 2010.