5.5 Module graph.axis.texter: Texter

The following classes are part of the module graph.axis.texter. Instances of the classes can be passed to the texter keyword argument of regular axes. Texters are used to define the label text for ticks, which request to have a label, but for which no label text has been specified so far. A typical case are ticks created by partitioners described above.

class decimal( prefix="", infix="", suffix="", equalprecision=0, decimalsep=".", thousandsep="", thousandthpartsep="", plus="", minus="-", period=r"\overline{%s}", labelattrs=[text.mathmode])
Instances of this class create decimal formatted labels.

The strings prefix, infix, and suffix are added to the label at the beginning, immediately after the plus or minus, and at the end, respectively. decimalsep, thousandsep, and thousandthpartsep are strings used to separate integer from fractional part and three-digit groups in the integer and fractional part. The strings plus and minus are inserted in front of the unsigned value for non-negative and negative numbers, respectively.

The format string period should generate a period. It must contain one string insert operators %s for the period.

labelattrs is a list of attributes to be added to the label attributes given in the painter. It should be used to setup TEX features like text.mathmode. Text format options like text.size should instead be set at the painter.

class exponential( plus="", minus="-", mantissaexp=r"{{%s}\cdot10^{%s}}", skipexp0=r"{%s}", skipexp1=None, nomantissaexp=r"{10^{%s}}", minusnomantissaexp=r"{-10^{%s}}", mantissamin=tick.rational((1, 1)), mantissamax=tick.rational((10L, 1)), skipmantissa1=0, skipallmantissa1=1, mantissatexter=decimal())
Instances of this class create decimal formatted labels with an exponential.

The strings plus and minus are inserted in front of the unsigned value of the exponent.

The format string mantissaexp should generate the exponent. It must contain two string insert operators %s, the first for the mantissa and the second for the exponent. An alternative to the default is r"{{%s}{\rm e}{%s}}".

The format string skipexp0 is used to skip exponent 0 and must contain one string insert operator %s for the mantissa. None turns off the special handling of exponent 0. The format string skipexp1 is similar to skipexp0, but for exponent 1.

The format string nomantissaexp is used to skip the mantissa 1 and must contain one string insert operator %s for the exponent. None turns off the special handling of mantissa 1. The format string minusnomantissaexp is similar to nomantissaexp, but for mantissa -1.

The tick.rational instances mantissamin< mantissamax are minimum (including) and maximum (excluding) of the mantissa.

The boolean skipmantissa1 enables the skipping of any mantissa equals 1 and -1, when minusnomantissaexp is set. When the boolean skipallmantissa1 is set, a mantissa equals 1 is skipped only, when all mantissa values are 1. Skipping of a mantissa is stronger than the skipping of an exponent.

mantissatexter is a texter instance for the mantissa.

class mixed( smallestdecimal=tick.rational((1, 1000)), biggestdecimal=tick.rational((9999, 1)), equaldecision=1, decimal=decimal(), exponential=exponential())
Instances of this class create decimal formatted labels with an exponential, when the unsigned values are small or large compared to 1.

The rational instances smallestdecimal and biggestdecimal are the smallest and biggest decimal values, where the decimal texter should be used. The sign of the value is ignored here. For a tick at zero the decimal texter is considered best as well. equaldecision is a boolean to indicate whether the decision for the decimal or exponential texter should be done globally for all ticks.

decimal and exponential are a decimal and an exponential texter instance, respectively.

class rational( prefix="", infix="", suffix="", numprefix="", numinfix="", numsuffix="", denomprefix="", denominfix="", denomsuffix="", plus="", minus="-", minuspos=0, over=r"%s\over%s", equaldenom=0, skip1=1, skipnum0=1, skipnum1=1, skipdenom1=1, labelattrs=[text.mathmode])
Instances of this class create labels formated as fractions.

The strings prefix, infix, and suffix are added to the label at the beginning, immediately after the plus or minus, and at the end, respectively. The strings numprefix, numinfix, and numsuffix are added to the labels numerator accordingly whereas denomprefix, denominfix, and denomsuffix do the same for the denominator.

The strings plus and minus are inserted in front of the unsigned value. The position of the sign is defined by minuspos with values 1 (at the numerator), 0 (in front of the fraction), and -1 (at the denominator).

The format string over should generate the fraction. It must contain two string insert operators %s, the first for the numerator and the second for the denominator. An alternative to the default is "{{%s}/{%s}}".

Usually, the numerator and denominator are canceled, while, when equaldenom is set, the least common multiple of all denominators is used.

The boolean skip1 indicates, that only the prefix, plus or minus, the infix and the suffix should be printed, when the value is 1 or -1 and at least one of prefix, infix and suffix is present.

The boolean skipnum0 indicates, that only a 0 is printed when the numerator is zero.

skipnum1 is like skip1 but for the numerator.

skipdenom1 skips the denominator, when it is 1 taking into account denomprefix, denominfix, denomsuffix minuspos and the sign of the number.

labelattrs has the same meaning as for decimal.