A newer version of the Gradio SDK is available: 6.20.0
Table
Qualified name: manim.mobject.table.Table
class Table(table, row_labels=None, col_labels=None, top_left_entry=None, v_buff=0.8, h_buff=1.3, include_outer_lines=False, add_background_rectangles_to_entries=False, entries_background_color=ManimColor('#000000'), include_background_rectangle=False, background_rectangle_color=ManimColor('#000000'), element_to_mobject=<class 'manim.mobject.text.text_mobject.Paragraph'>, element_to_mobject_config={}, arrange_in_grid_config={}, line_config={}, **kwargs)
Bases: VGroup
A mobject that displays a table on the screen.
- Parameters:
- table (Iterable *[**Iterable* *[**float* *|* *str* *|* VMobject ] ]) β A 2D array or list of lists. Content of the table has to be a valid input
for the callable set in
element_to_mobject. - row_labels (Iterable *[*VMobject ] | None) β List of
VMobjectrepresenting the labels of each row. - col_labels (Iterable *[*VMobject ] | None) β List of
VMobjectrepresenting the labels of each column. - top_left_entry (VMobject | None) β The top-left entry of the table, can only be specified if row and column labels are given.
- v_buff (float) β Vertical buffer passed to
arrange_in_grid(), by default 0.8. - h_buff (float) β Horizontal buffer passed to
arrange_in_grid(), by default 1.3. - include_outer_lines (bool) β
Trueif the table should include outer lines, by default False. - add_background_rectangles_to_entries (bool) β
Trueif background rectangles should be added to entries, by defaultFalse. - entries_background_color (ParsableManimColor) β Background color of entries if
add_background_rectangles_to_entriesisTrue. - include_background_rectangle (bool) β
Trueif the table should have a background rectangle, by defaultFalse. - background_rectangle_color (ParsableManimColor) β Background color of table if
include_background_rectangleisTrue. - element_to_mobject (Callable *[* *[**float* *|* *str* *|* VMobject ] , VMobject ]) β The
Mobjectclass applied to the table entries. by defaultParagraph. For common choices, seetext_mobject/tex_mobject. - element_to_mobject_config (dict) β Custom configuration passed to
element_to_mobject, by default {}. - arrange_in_grid_config (dict) β Dict passed to
arrange_in_grid(), customizes the arrangement of the table. - line_config (dict) β Dict passed to
Line, customizes the lines of the table. - kwargs β Additional arguments to be passed to
VGroup.
- table (Iterable *[**Iterable* *[**float* *|* *str* *|* VMobject ] ]) β A 2D array or list of lists. Content of the table has to be a valid input
for the callable set in
Examples
Methods
add_background_to_entries |
Adds a black BackgroundRectangle to each entry of the table. |
|---|---|
add_highlighted_cell |
Highlights one cell at a specific position on the table by adding a BackgroundRectangle. |
create |
Customized create-type function for tables. |
get_cell |
Returns one specific cell as a rectangular Polygon without the entry. |
get_col_labels |
Return the column labels of the table. |
get_columns |
Return columns of the table as a VGroup of VGroup. |
get_entries |
Return the individual entries of the table (including labels) or one specific entry if the parameter, pos, is set. |
get_entries_without_labels |
Return the individual entries of the table (without labels) or one specific entry if the parameter, pos, is set. |
get_highlighted_cell |
Returns a BackgroundRectangle of the cell at the given position. |
get_horizontal_lines |
Return the horizontal lines of the table. |
get_labels |
Returns the labels of the table. |
get_row_labels |
Return the row labels of the table. |
get_rows |
Return the rows of the table as a VGroup of VGroup. |
get_vertical_lines |
Return the vertical lines of the table. |
scale |
Scale the size by a factor. |
set_column_colors |
Set individual colors for each column of the table. |
set_row_colors |
Set individual colors for each row of the table. |
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. |
_add_horizontal_lines()
Adds the horizontal lines to the table.
- Return type: Table
_add_labels(mob_table)
Adds labels to an in a grid arranged VGroup.
- Parameters: mob_table (VGroup) β An in a grid organized class:~.VGroup.
- Returns:
Returns the
mob_tablewith added labels. - Return type:
VGroup
_add_vertical_lines()
Adds the vertical lines to the table
- Return type: Table
_organize_mob_table(table)
Arranges the VMobject of table in a grid.
- Parameters:
table (Iterable *[**Iterable* *[*VMobject ] ]) β A 2D iterable object with
VMobjectentries. - Returns:
The
VMobjectof thetablein aVGroupalready arranged in a table-like grid. - Return type:
VGroup
_original__init__(table, row_labels=None, col_labels=None, top_left_entry=None, v_buff=0.8, h_buff=1.3, include_outer_lines=False, add_background_rectangles_to_entries=False, entries_background_color=ManimColor('#000000'), include_background_rectangle=False, background_rectangle_color=ManimColor('#000000'), element_to_mobject=<class 'manim.mobject.text.text_mobject.Paragraph'>, element_to_mobject_config={}, arrange_in_grid_config={}, line_config={}, **kwargs)
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
- table (Iterable *[**Iterable* *[**float* *|* *str* *|* VMobject ] ])
- row_labels (Iterable *[*VMobject ] | None)
- col_labels (Iterable *[*VMobject ] | None)
- top_left_entry (VMobject | None)
- v_buff (float)
- h_buff (float)
- include_outer_lines (bool)
- add_background_rectangles_to_entries (bool)
- entries_background_color (ParsableManimColor)
- include_background_rectangle (bool)
- background_rectangle_color (ParsableManimColor)
- element_to_mobject (Callable *[* *[**float* *|* *str* *|* VMobject ] , VMobject ])
- element_to_mobject_config (dict)
- arrange_in_grid_config (dict)
- line_config (dict)
_table_to_mob_table(table)
Initializes the entries of table as VMobject.
- Parameters:
table (Iterable *[**Iterable* *[**float* *|* *str* *|* VMobject ] ]) β A 2D array or list of lists. Content of the table has to be a valid input
for the callable set in
element_to_mobject. - Returns:
List of
VMobjectfrom the entries oftable. - Return type: List
add_background_to_entries(color=ManimColor('#000000'))
Adds a black BackgroundRectangle to each entry of the table.
- Parameters: color (ParsableManimColor)
- Return type: Table
add_highlighted_cell(pos=(1, 1), color=ManimColor('#FFFF00'), **kwargs)
Highlights one cell at a specific position on the table by adding a BackgroundRectangle.
- Parameters:
- pos (Sequence *[*int ]) β The position of a specific entry on the table.
(1,1)being the top left entry of the table. - color (ParsableManimColor) β The color used to highlight the cell.
- kwargs β Additional arguments to be passed to
BackgroundRectangle.
- pos (Sequence *[*int ]) β The position of a specific entry on the table.
- Return type: Table
Examples
create(lag_ratio=1, line_animation=<class 'manim.animation.creation.Create'>, label_animation=<class 'manim.animation.creation.Write'>, element_animation=<class 'manim.animation.creation.Create'>, entry_animation=<class 'manim.animation.fading.FadeIn'>, **kwargs)
Customized create-type function for tables.
- Parameters:
- lag_ratio (float) β The lag ratio of the animation.
- line_animation (Callable *[* *[*VMobject | VGroup ] , Animation ]) β The animation style of the table lines, see
creationfor examples. - label_animation (Callable *[* *[*VMobject | VGroup ] , Animation ]) β The animation style of the table labels, see
creationfor examples. - element_animation (Callable *[* *[*VMobject | VGroup ] , Animation ]) β The animation style of the table elements, see
creationfor examples. - entry_animation (Callable *[* *[*VMobject | VGroup ] , Animation ]) β The entry animation of the table background, see
creationfor examples. - kwargs β Further arguments passed to the creation animations.
- Returns: AnimationGroup containing creation of the lines and of the elements.
- Return type:
AnimationGroup
Examples
get_cell(pos=(1, 1), **kwargs)
Returns one specific cell as a rectangular Polygon without the entry.
- Parameters:
- pos (Sequence *[*int ]) β The position of a specific entry on the table.
(1,1)being the top left entry of the table. - kwargs β Additional arguments to be passed to
Polygon.
- pos (Sequence *[*int ]) β The position of a specific entry on the table.
- Returns: Polygon mimicking one specific cell of the Table.
- Return type:
Polygon
Examples
get_col_labels()
Return the column labels of the table.
- Returns: VGroup containing the column labels of the table.
- Return type:
VGroup
Examples
get_columns()
Return columns of the table as a VGroup of VGroup.
Examples
get_entries(pos=None)
Return the individual entries of the table (including labels) or one specific entry
if the parameter, pos, is set.
- Parameters:
pos (Sequence *[*int ] | None) β The position of a specific entry on the table.
(1,1)being the top left entry of the table. - Returns:
VGroupcontaining all entries of the table (including labels) or theVMobjectat the given position ifposis set. - Return type:
Union[
VMobject,VGroup]
Examples
get_entries_without_labels(pos=None)
Return the individual entries of the table (without labels) or one specific entry
if the parameter, pos, is set.
- Parameters:
pos (Sequence *[*int ] | None) β The position of a specific entry on the table.
(1,1)being the top left entry of the table (without labels). - Returns:
VGroupcontaining all entries of the table (without labels) or theVMobjectat the given position ifposis set. - Return type:
Union[
VMobject,VGroup]
Examples
get_highlighted_cell(pos=(1, 1), color=ManimColor('#FFFF00'), **kwargs)
Returns a BackgroundRectangle of the cell at the given position.
- Parameters:
- pos (Sequence *[*int ]) β The position of a specific entry on the table.
(1,1)being the top left entry of the table. - color (ParsableManimColor) β The color used to highlight the cell.
- kwargs β Additional arguments to be passed to
BackgroundRectangle.
- pos (Sequence *[*int ]) β The position of a specific entry on the table.
- Return type: BackgroundRectangle
Examples
get_horizontal_lines()
Return the horizontal lines of the table.
Examples
get_labels()
Returns the labels of the table.
Examples
get_row_labels()
Return the row labels of the table.
Examples
get_rows()
Return the rows of the table as a VGroup of VGroup.
Examples
get_vertical_lines()
Return the vertical lines of the table.
Examples
scale(scale_factor, **kwargs)
Scale the size by a factor.
Default behavior is to scale about the center of the vmobject.
- Parameters:
- scale_factor (float) β The scaling factor $\alpha$. If $0 < |\alpha| < 1$, the mobject will shrink, and for $|\alpha| > 1$ it will grow. Furthermore, if $\alpha < 0$, the mobject is also flipped.
- scale_stroke β Boolean determining if the objectβs outline is scaled when the object is scaled. If enabled, and object with 2px outline is scaled by a factor of .5, it will have an outline of 1px.
- kwargs β Additional keyword arguments passed to
scale().
- Returns:
self - Return type:
VMobject
Examples
SEE ALSO
move_to()
set_column_colors(*colors)
Set individual colors for each column of the table.
- Parameters: colors (Iterable *[*ParsableManimColor ]) β An iterable of colors; each color corresponds to a column.
- Return type: Table
Examples
set_row_colors(*colors)
Set individual colors for each row of the table.
- Parameters: colors (Iterable *[*ParsableManimColor ]) β An iterable of colors; each color corresponds to a row.
- Return type: Table