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].

Figure 1: Stacked graph view (left) showing 40 job occupation names starting with the prefix “A”, and TLV = 0 pixels. A number of labels are illegible due to either overlapping or small size. The solid line encloses the visualization area, and the dotted line the unused space. At the right, an increased section of the same view (top) with TLV = 12 pixels (some labels are hidden). The same section (bottom) can be seen with TLV = 0 (some labels are overlapped) and with their minimum font size increased three times.

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 5×8 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.

Figure 2: Partition of the visualization area of the stacked graph of Figure 1. Partitions in blue color correspond to the candidate partitions for label layout.

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:Γ0Γ=0;𝑛=𝛾𝑛+Γ𝑛−2𝛾𝑛.(1)
Here, 𝛾𝑛=⌊log2𝑛⌋ denotes a locus encoding a partial gene evaluation.

Table 1: Chromosome encoding.

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:

𝐹1: Minimize the overlapping between labels,

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

The fitness value for 𝐹1 for individual 𝑖 is inversely proportional to the number of labels with overlapping:
𝐹1Φ(𝑖)=1−overlapping(𝑖),overlapping(𝑖)=𝑖||𝐿||,(2)
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 𝐹2 is proportional to the correlation between the label order and stripe order. For each individual 𝑖, we calculate two tuples. A tuple of partition positions (PP) is obtained from the absolute 𝑦-coordinates of the encoded partitions, and a tuple of stripe positions (SP) 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:𝐹2(𝑖)=pc(PP,SP)+12,(3)
where pc denotes the Pearson product moment correlation coefficient. Note that |PP|=|SP|=|𝐿|. Finally, the total fitness value for indivual 𝑖 is obtained asﬁtness𝑖=𝑤1𝐹1(𝑖)+𝑤2𝐹2(𝑖),(4)
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 𝐶−1 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 𝐶−1 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 |𝐿|−1 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 𝐴: 06|2879

offspring 𝐴′: 06𝟔𝟑𝟏𝟐

parent 𝐵: 95|6312

offspring 𝐵′: 95𝟐𝟖𝟕𝟗

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 𝐴: 6,2,3,4,1,7,5 and 𝐵: 5,2,4,1,3,7,6.

swap 4 and 1

swap 3 and 4

no change

first offspring

623|417|5

623𝟏475

624𝟏𝟑75

𝐴′∶624𝟏𝟑𝟕5

↑

↑

↑

524|𝟏𝟑𝟕|6

5241376

5241376

623|𝟒𝟏𝟕|5

6234175

6234175

↓

↓

↓

524|137|6

521𝟒376

523𝟒𝟏76

𝐵′∶523𝟒𝟏𝟕6

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 1,3,7 and 4,1,7 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 𝐴: 0,6,2,8,7,9 and 𝐵: 9,5,6,3,1,2.

swap 6 and 2

replace 8 with 3

first offspring

06|28|79

02𝟔879

02𝟔𝟑79

↑

↑

95|𝟔𝟑|12

956312

06|𝟐𝟖|79

062879

↓

↓

95|63|12

952316

95𝟐𝟖16

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 (𝑤1=1,𝑤2=0), 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 40% the base minimum size of each label. We also used five different grid layouts for partitioning the visualization area, 10×10, 12×12, 14×14, 16×16, and 18×18; 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 1/|𝐿|. 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 (𝑄𝑆𝑛) 𝑄𝑆1: Fitness value obtained at generation 500. 𝑄𝑆2: Difference between 𝑄𝑆1 and the initial fitness value.(2)Convergence Speed (𝐶𝑆𝑛)𝐶𝑆1: Best-fitness average of all generations [16]1𝑇𝑇𝑗=1𝑓𝑡.(5)𝐶𝑆2: Difference between 𝐶𝑆1 and the initial fitness value.

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

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

Table 2: Comparison of configurations C1M1, C1M2, C2M1, C2M2 on five different numbers of candidate partitions (left side) and five numbers of population sizes. The best result among candidate partitions is emphasized in boldface. For each candidate solution number, the first row corresponds to the 𝑄𝑆1 measurement, the second to 𝑄𝑆2, the third to 𝐶𝑆1, and the last one to 𝐶𝑆2.

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

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

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, 99% of the time, the other two operators. Another observation is that our best results of C2M2 were concentrated on configurations sharing the grid layout 14×14 (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 𝑄𝑆1, 𝐶𝑆1=0.841, is the third best convergence speed. Moreover, it has no significant difference with the best convergence speed 𝐶𝑆1=0.849. This number is associated to the group of 71 candidate partitions (14×14) and was also obtained from the combination C2M2. In general, this can be explained by the variations in the number of individuals 50≤𝐶≤125, 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 𝑄S1, 𝑄𝑆2, 𝐶𝑆1, and 𝐶𝑆2 are given.

Figure 3: Performance comparison among C1M1, C1M2, C2M1, and C2M2. Best fitness value versus generation number is plotted for three configurations.

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 4: Performance comparison among C1M1, C1M2, C2M1, and C2M2 for three configurations for the three variables (i) population size, (ii) candidate partitions, and (iii) fitness value.

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 𝑤1=𝑤2=0.5 was used. Figure 5(b) and Figure 5(c) show the results of views with prefixes “C” and “F”, respectively.

Figure 5: Stacked graph views produced by our genetic algorithm. (a) view showing 25 job occupation names starting with the prefix “A”. This view was produced using the weight parameters 𝑤1=𝑤2=0∶5, that is, free from overlapping, and the order of labels are correlated with the order of stripes. Similarly, using 𝑤1=1; 𝑤2=0, (b) corresponds to a view with the prefix “C”, and (c) to a view with the prefix “F”.

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.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.

Speed tests indicate that V1 and V2 required significantly more time to read than V3 (𝑃<0.05). 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 (𝑃<0.05).

A similar ANOVA of speed test indicated significant main effects among view prefixes when V2 is used (𝑃<0.05), 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 (𝑃<0.05). 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 (𝑃<0.05), 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 (𝑃<0.05). 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.

Figure 6: Comparison results of the conducted usability study with the three versions of the stacked graph visualization. Two different values for TLV (threshold for label visibility) are used in the three versions, as well as our proposed stacked graph with automatic label layout on unused space. The comparison among versions are shown for each view prefix.

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.