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 withDecimalNumber
to display decimal entries.Examples
Example: DecimalTableExample ¶
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
withelement_to_mobject
set toDecimalNumber
. By default,num_decimal_places
is set to 1. Will round/truncate the decimal places based on the providedelement_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 asDecimalNumber
.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.