DecimalTable

Qualified name: manim.mobject.table.DecimalTable

class DecimalTable(table, element_to_mobject=<class 'manim.mobject.numbers.DecimalNumber'>, element_to_mobject_config={'num_decimal_places': 1}, **kwargs)[source]

Bases: manim.mobject.table.Table

A specialized Table mobject for use with with DecimalNumber to display decimal entries.

Examples

Example: DecimalTableExample

../_images/DecimalTableExample-1.png
from manim import *

class DecimalTableExample(Scene):
    def construct(self):
        x_vals = [-2,-1,0,1,2]
        y_vals = np.exp(x_vals)
        t0 = DecimalTable(
            [x_vals, y_vals],
            row_labels=[MathTex("x"), MathTex("f(x)=e^{x}")],
            h_buff=1,
            element_to_mobject_config={"num_decimal_places": 2})
        self.add(t0)

Special case of Table with element_to_mobject set to DecimalNumber. By default, num_decimal_places is set to 1. Will round/truncate the decimal places based on the provided element_to_mobject_config.

Parameters
  • table (Iterable[Iterable[Union[float, str]]]) – A 2D array, or a list of lists. Content of the table must be valid input for DecimalNumber.

  • element_to_mobject (Callable[[Union[float, str]], VMobject]) – The Mobject class applied to the table entries. Set as DecimalNumber.

  • element_to_mobject_config (dict) – Element to mobject config, here set as {“num_decimal_places”: 1}.

  • kwargs (Any) – Additional arguments to be passed to Table.

Methods

Attributes

animate

Used to animate the application of a method.

animation_overrides

depth

The depth of the mobject.

height

The height of the mobject.

width

The width of the mobject.