DecimalTable#

Qualified name: manim.mobject.table.DecimalTable

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

Bases: Table

A specialized Table mobject for use 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)
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[float | str]]) – A 2D array, or a list of lists. Content of the table must be valid input for DecimalNumber.

  • element_to_mobject (Callable[[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 – Additional arguments to be passed to Table.

Methods

Attributes

animate

Used to animate the application of any method of self.

animation_overrides

color

depth

The depth of the mobject.

fill_color

If there are multiple colors (for gradient) this returns the first one

height

The height of the mobject.

n_points_per_curve

sheen_factor

stroke_color

width

The width of the mobject.

_original__init__(table, element_to_mobject=<class 'manim.mobject.text.numbers.DecimalNumber'>, element_to_mobject_config={'num_decimal_places': 1}, **kwargs)#

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[float | str]]) – A 2D array, or a list of lists. Content of the table must be valid input for DecimalNumber.

  • element_to_mobject (Callable[[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 – Additional arguments to be passed to Table.