Repository: ManimCommunity/manim
File: manim/mobject/text/numbers.py (Python)

Code before:


class DecimalNumber(VMobject, metaclass=ConvertToOpenGL):
    """An mobject representing a decimal number.

    Parameters
    ----------
    number
        The numeric value to be displayed. It can later be modified using `.set_value()`.
    num_decimal_places
        The number of decimal places after the decimal separator. Values are automatically rounded.
    mob_class
        The class for rendering digits and units, by default `MathTex`.
    include_sign
        Set to `True` to include a sign for positive numbers and zero.
    group_with_commas
        When `True` thousands groups are separated by commas for readability.
    digit_buff_per_font_unit
        Additional spacing between digits. Scales with font size.
    show_ellipsis
        When a number has been truncated by rounding, indicate with an ellipsis (...).
    unit
        A unit string which can be placed to the right of the numerical values.
    unit_buff_per_font_unit
        An additional spacing between the numerical values and the unit. A value
        of `unit_buff_per_font_unit=0.003` gives a decent spacing. Scales with font size.
    include_background_rectangle
        Adds a background rectangle to increase contrast on busy scenes.
    edge_to_fix
        Assuring right- or left-alignment of the full object.
    font_size
        Size of the font

    Examples
    --------

    .. manim:: MovingSquareWithUpdaters

        class MovingSquareWithUpdaters(Scene):
            def construct(self):
                decimal = DecimalNumber(
                    0,
                    show_ellipsis=True,
                    num_decimal_places=3,
                    include_sign=True,
                    unit=r"\text{M-Units}",
                    unit_buff_per_font_unit=0.003
                )
                square = Square().to_edge(UP)

                decimal.add_updater(lambda d: d.next_to(square, RIGHT))

Review comment (suggestion):
```suggestion
        of ``unit_buff_per_font_unit=0.003`` gives a decent spacing. Scales with font size.
```

Code after:


class DecimalNumber(VMobject, metaclass=ConvertToOpenGL):
    """An mobject representing a decimal number.

    Parameters
    ----------
    number
        The numeric value to be displayed. It can later be modified using :meth:`.set_value`.
    num_decimal_places
        The number of decimal places after the decimal separator. Values are automatically rounded.
    mob_class
        The class for rendering digits and units, by default :class:`.MathTex`.
    include_sign
        Set to ``True`` to include a sign for positive numbers and zero.
    group_with_commas
        When ``True`` thousands groups are separated by commas for readability.
    digit_buff_per_font_unit
        Additional spacing between digits. Scales with font size.
    show_ellipsis
        When a number has been truncated by rounding, indicate with an ellipsis (``...``).
    unit
        A unit string which can be placed to the right of the numerical values.
    unit_buff_per_font_unit
        An additional spacing between the numerical values and the unit. A value
        of ``unit_buff_per_font_unit=0.003`` gives a decent spacing. Scales with font size.
    include_background_rectangle
        Adds a background rectangle to increase contrast on busy scenes.
    edge_to_fix
        Assuring right- or left-alignment of the full object.
    font_size
        Size of the font.

    Examples
    --------

    .. manim:: MovingSquareWithUpdaters

        class MovingSquareWithUpdaters(Scene):
            def construct(self):
                decimal = DecimalNumber(
                    0,
                    show_ellipsis=True,
                    num_decimal_places=3,
                    include_sign=True,
                    unit=r"\text{M-Units}",
                    unit_buff_per_font_unit=0.003
                )
                square = Square().to_edge(UP)

                decimal.add_updater(lambda d: d.next_to(square, RIGHT))