The rating of axes is implemented in graph.axis.rater. When an axis partitioning scheme returns several partitioning possibilities, the partitions need to be rated by a positive number. The axis partitioning rated lowest is considered best.
The rating consists of two steps. The first takes into account only the number of ticks, subticks, labels and so on in comparison to optimal numbers. Additionally, the extension of the axis range by ticks and labels is taken into account. This rating leads to a preselection of possible partitions. In the second step, after the layout of preferred partitionings has been calculated, the distance of the labels in a partition is taken into account as well at a smaller weight factor by default. Thereby partitions with overlapping labels will be rejected completely. Exceptionally sparse or dense labels will receive a bad rating as well.
| opt, left=None, right=None, weight=1) |
0 and
right is set to 3*opt. Weight is a multiplicator
to the result.
The rater calculates
width*((x-opt)/(other-opt))**3 to rate the
value x, where other is left
(x<opt) or right
(x>opt).
| opt, weight=0.1) |
The rater calculates the sum of weight*(opt/x-1)
(x<opt) or weight*(x/opt-1)
(x>opt) for all elements x of the
list. It returns this value divided by the number of elements in the
list.
| ticks, labels, range, distance) |
ticks and labels are both lists of number rater instances, where the first items are used for the number of ticks and labels, the second items are used for the number of subticks (including the ticks) and sublabels (including the labels) and so on until the end of the list is reached or no corresponding ticks are available.
range is a number rater instance which rates the range of the ticks relative to the range of the data.
distance is an distance rater instance.
| ticks=[cube(4), cube(10, weight=0.5)], labels=[cube(4)], range=cube(1, weight=2), distance=distance("1 cm")) |
| ...) |
| ticks=[cube(5, right=20), cube(20, right=100, weight=0.5)], labels=[cube(5, right=20), cube(5, right=20, weight=0.5)], range=cube(1, weight=2), distance=distance("1 cm")) |
| ...) |