Matrices and tables¶
The film's code
import manimgx as m
class MatricesAndTablesHero(m.Scene):
def construct(self) -> None:
matrix = m.Matrix([[2, 0], [1, 3]])
matrix.set_column_colors(m.YELLOW, m.BLUE)
table = m.Table(
[["1", "2"], ["4", "8"]],
row_labels=[m.Text("x"), m.Text("2ˣ")],
col_labels=[m.Text("a"), m.Text("b")],
).scale(0.7)
m.VGroup(matrix, table).arrange(buff=1.5)
self.play(m.Write(matrix))
self.play(table.create())
self.wait()
A matrix and a table hold entries in rows and columns: a matrix between brackets, a table between lines, with labels for its rows and columns if you give them. Give the entries as values, and each kind of matrix or table makes their mobjects: numbers, integers, math, text, or the mobjects themselves. Each row, each column and each entry is a mobject, to color and animate.
Matrix ¶

Code
import manimgx as m
class MatrixExample(m.Scene):
def construct(self) -> None:
matrices = m.VGroup(
m.Matrix([[2, 0], [-1, 1]]),
m.Matrix(
[[r"\cos t", r"-\sin t"], [r"\sin t", r"\cos t"]],
h_buff=2,
left_bracket="(",
right_bracket=")",
),
m.Matrix(
[[10, 2, 300], [4, 50, 6]],
element_alignment_corner=m.UL,
bracket_config={"color": m.BLUE},
),
).arrange(buff=1)
self.add(matrices)
A matrix: entries in rows and columns between brackets; white unless styled.
Each entry is made into a mobject by element_to_mobject — by default typeset as
math, with MathTex — and put on a grid, rows v_buff apart and
columns h_buff apart, by its bottom right corner (element_alignment_corner): the
entries of a column are aligned on their right. Brackets, typeset as LaTeX
delimiters, stand on either side, stretched to the entries' height; the matrix is
centered on the scene's origin. Its entries and
brackets can be reached, colored and animated, and
so can its rows and columns: get_rows() and get_columns() give them as groups,
set_row_colors(...) and set_column_colors(...) color them.
Layout and bracket options are used during construction; the resulting cells and brackets hold the matrix's state.
m.Matrix(matrix, v_buff=0.8, h_buff=1.3, bracket_h_buff=MED_SMALL_BUFF, bracket_v_buff=MED_SMALL_BUFF, add_background_rectangles_to_entries=False, include_background_rectangle=False, element_to_mobject=None, element_to_mobject_config=None, element_alignment_corner=DR, left_bracket='[', right_bracket=']', stretch_brackets=True, bracket_config=None, **kwargs)
matrixThe entries, row by row: numbers, strings of math or mobjects, as
element_to_mobjecttakes them.v_buffThe distance between rows, in scene units, from one row's entries' alignment corners to the next's.
h_buffThe distance between columns, in scene units, likewise.
bracket_h_buffThe gap between the entries and each bracket, in scene units.
bracket_v_buffHow far the brackets reach above and below the entries, in scene units, when stretched.
add_background_rectangles_to_entriesWhether each entry gets a background rectangle, in the scene's background color (see add_background_rectangle).
include_background_rectangleWhether the matrix gets a background rectangle (see add_background_rectangle).
element_to_mobjectThe function that makes each entry's mobject, called with the entry and the keywords of
element_to_mobject_config: a class, as DecimalNumber, or any function; None for the class's own (MathTex, for a Matrix).element_to_mobject_configKeywords for
element_to_mobject; None for the class's own (none, for a Matrix).element_alignment_cornerThe corner of each entry put on the grid, named by a direction: DR aligns the entries of a column on their right, UL on their left.
left_bracketThe left bracket, as a LaTeX delimiter:
"[","(","\{","\langle","|", ….right_bracketThe right bracket, as a LaTeX delimiter.
stretch_bracketsWhether the brackets are stretched to the entries' height, and
bracket_v_buffbeyond.bracket_configMath keywords for the brackets: their
color, …; None for none.colorThe color of both fill and stroke (default white); None for the class's default.
fill_colorThe fill's color;
colorif not given. Several colors make a gradient alongsheen_direction.fill_opacityThe fill's opacity, from 0 to 1 (default 0: no fill).
stroke_colorThe stroke's color;
colorif not given. Several colors make a gradient.stroke_opacityThe stroke's opacity, from 0 to 1 (default 1).
stroke_widthThe stroke's width, in hundredths of a scene unit (default 4; 0: no stroke).
background_stroke_colorThe color of an outline drawn behind the fill (default black).
background_stroke_opacityThe outline's opacity, from 0 to 1 (default 1).
background_stroke_widthThe outline's width, in hundredths of a scene unit (default 0: none).
sheen_factorHow much the colors lighten toward
sheen_direction, from -1 to 1 (default 0); a negative factor darkens.sheen_directionThe direction the colors lighten toward (default
UL).joint_typeHow the stroke is joined where its path turns: round, beveled or mitered, as a two-dimensional scene draws it (see LineJointType; default AUTO: mitered).
cap_styleHow the stroke ends, at each end it shows (an open path's, a dash's): round, butt or square, as a two-dimensional scene draws it (see CapStyleType; default AUTO: butt).
shade_in_3dWhether a three-dimensional scene's light shades the mobject.
materialHow its surface reflects the scene's lights in a three-dimensional scene (see Material); None: Manim's shading (default).
nameA name for the mobject; its class's name if not given.
z_indexIts place in the drawing order: a higher index is drawn over a lower one (default 0).
targetThe state
MoveToTargetmoves the mobject to.
It also takes the style keywords.
Source
src/manimgx/mobjects/grid.py
entry ¶
The function that makes each entry's mobject when the constructor is given no
element_to_mobject: a class, as MathTex, or any function. A
subclass sets its own (IntegerMatrix's is
Integer).
entry_config ¶
The keywords entry is called with when the constructor is given no
element_to_mobject_config (none, unless a subclass sets them).
elements ¶
The entries, row by row: a group, added to the matrix.
get_rows ¶
The rows, from the top down, each a group of its entries from left to right (a table's labels included).
Returns A new group of the rows.
Source
src/manimgx/mobjects/grid.py
get_columns ¶
Code
import manimgx as m
class TableGetColumnsExample(m.Scene):
def construct(self) -> None:
table = m.Table(
[["First", "Second"], ["Third", "Fourth"]],
row_labels=[m.Text("R1"), m.Text("R2")],
col_labels=[m.Text("C1"), m.Text("C2")],
)
column = m.SurroundingRectangle(table.get_columns()[1])
self.add(table)
self.play(m.Create(column))
The columns, from left to right, each a group of its entries from the top down (a table's labels included).
Returns A new group of the columns.
Source
src/manimgx/mobjects/grid.py
set_row_colors ¶

Color the rows, from the top down: each one color, or several for a gradient (as set_color makes one); rows past the last color keep theirs.
*colorsThe rows' colors, in order: a color each, or a list of colors.
Source
src/manimgx/mobjects/grid.py
set_column_colors ¶

Code
Color the columns, from left to right: each one color, or several for a gradient (as set_color makes one); columns past the last color keep theirs.
*colorsThe columns' colors, in order: a color each, or a list of colors.
Source
src/manimgx/mobjects/grid.py
get_entries ¶
The matrix's entries, row by row.
Returns
The group of the entries; get_entries()[1] is the second entry of the
first row.
Source
src/manimgx/mobjects/grid.py
get_brackets ¶
The matrix's brackets, the left one first.
Returns The group of the two brackets.
Source
src/manimgx/mobjects/grid.py
DecimalMatrix ¶

A matrix of decimal numbers: each entry written as a DecimalNumber, with one decimal place unless configured.
It takes a Matrix's arguments; its entries are numbers, and its
element_to_mobject_config gives the numbers'
keywords, in place of
{"num_decimal_places": 1}.
m.DecimalMatrix(matrix, v_buff=0.8, h_buff=1.3, bracket_h_buff=MED_SMALL_BUFF, bracket_v_buff=MED_SMALL_BUFF, add_background_rectangles_to_entries=False, include_background_rectangle=False, element_to_mobject=None, element_to_mobject_config=None, element_alignment_corner=DR, left_bracket='[', right_bracket=']', stretch_brackets=True, bracket_config=None, **kwargs)
colorThe color of both fill and stroke (default white); None for the class's default.
fill_colorThe fill's color;
colorif not given. Several colors make a gradient alongsheen_direction.fill_opacityThe fill's opacity, from 0 to 1 (default 0: no fill).
stroke_colorThe stroke's color;
colorif not given. Several colors make a gradient.stroke_opacityThe stroke's opacity, from 0 to 1 (default 1).
stroke_widthThe stroke's width, in hundredths of a scene unit (default 4; 0: no stroke).
background_stroke_colorThe color of an outline drawn behind the fill (default black).
background_stroke_opacityThe outline's opacity, from 0 to 1 (default 1).
background_stroke_widthThe outline's width, in hundredths of a scene unit (default 0: none).
sheen_factorHow much the colors lighten toward
sheen_direction, from -1 to 1 (default 0); a negative factor darkens.sheen_directionThe direction the colors lighten toward (default
UL).joint_typeHow the stroke is joined where its path turns: round, beveled or mitered, as a two-dimensional scene draws it (see LineJointType; default AUTO: mitered).
cap_styleHow the stroke ends, at each end it shows (an open path's, a dash's): round, butt or square, as a two-dimensional scene draws it (see CapStyleType; default AUTO: butt).
shade_in_3dWhether a three-dimensional scene's light shades the mobject.
materialHow its surface reflects the scene's lights in a three-dimensional scene (see Material); None: Manim's shading (default).
nameA name for the mobject; its class's name if not given.
z_indexIts place in the drawing order: a higher index is drawn over a lower one (default 0).
targetThe state
MoveToTargetmoves the mobject to.
It also takes the style keywords.
Source
src/manimgx/mobjects/grid.py
IntegerMatrix ¶

A matrix of integers: each entry written as an Integer, its number rounded to a whole number.
It takes a Matrix's arguments; its entries are numbers, and its
element_to_mobject_config gives the numbers'
keywords.
m.IntegerMatrix(matrix, v_buff=0.8, h_buff=1.3, bracket_h_buff=MED_SMALL_BUFF, bracket_v_buff=MED_SMALL_BUFF, add_background_rectangles_to_entries=False, include_background_rectangle=False, element_to_mobject=None, element_to_mobject_config=None, element_alignment_corner=DR, left_bracket='[', right_bracket=']', stretch_brackets=True, bracket_config=None, **kwargs)
colorThe color of both fill and stroke (default white); None for the class's default.
fill_colorThe fill's color;
colorif not given. Several colors make a gradient alongsheen_direction.fill_opacityThe fill's opacity, from 0 to 1 (default 0: no fill).
stroke_colorThe stroke's color;
colorif not given. Several colors make a gradient.stroke_opacityThe stroke's opacity, from 0 to 1 (default 1).
stroke_widthThe stroke's width, in hundredths of a scene unit (default 4; 0: no stroke).
background_stroke_colorThe color of an outline drawn behind the fill (default black).
background_stroke_opacityThe outline's opacity, from 0 to 1 (default 1).
background_stroke_widthThe outline's width, in hundredths of a scene unit (default 0: none).
sheen_factorHow much the colors lighten toward
sheen_direction, from -1 to 1 (default 0); a negative factor darkens.sheen_directionThe direction the colors lighten toward (default
UL).joint_typeHow the stroke is joined where its path turns: round, beveled or mitered, as a two-dimensional scene draws it (see LineJointType; default AUTO: mitered).
cap_styleHow the stroke ends, at each end it shows (an open path's, a dash's): round, butt or square, as a two-dimensional scene draws it (see CapStyleType; default AUTO: butt).
shade_in_3dWhether a three-dimensional scene's light shades the mobject.
materialHow its surface reflects the scene's lights in a three-dimensional scene (see Material); None: Manim's shading (default).
nameA name for the mobject; its class's name if not given.
z_indexIts place in the drawing order: a higher index is drawn over a lower one (default 0).
targetThe state
MoveToTargetmoves the mobject to.
It also takes the style keywords.
Source
src/manimgx/mobjects/grid.py
MobjectMatrix ¶

Code
import manimgx as m
class MobjectMatrixExample(m.Scene):
def construct(self) -> None:
circle = m.Circle(radius=0.3, color=m.BLUE)
triangle = m.Triangle(radius=0.35, color=m.GREEN)
matrix = m.MobjectMatrix(
[[circle, m.Square(0.6)], [triangle, m.Star(outer_radius=0.35)]],
left_bracket=r"\langle",
right_bracket=r"\rangle",
)
self.add(matrix.scale(1.5))
A matrix of mobjects: each entry a mobject, placed as it is.
It takes a Matrix's arguments; its entries are mobjects, used themselves (not copied).
m.MobjectMatrix(matrix, v_buff=0.8, h_buff=1.3, bracket_h_buff=MED_SMALL_BUFF, bracket_v_buff=MED_SMALL_BUFF, add_background_rectangles_to_entries=False, include_background_rectangle=False, element_to_mobject=None, element_to_mobject_config=None, element_alignment_corner=DR, left_bracket='[', right_bracket=']', stretch_brackets=True, bracket_config=None, **kwargs)
colorThe color of both fill and stroke (default white); None for the class's default.
fill_colorThe fill's color;
colorif not given. Several colors make a gradient alongsheen_direction.fill_opacityThe fill's opacity, from 0 to 1 (default 0: no fill).
stroke_colorThe stroke's color;
colorif not given. Several colors make a gradient.stroke_opacityThe stroke's opacity, from 0 to 1 (default 1).
stroke_widthThe stroke's width, in hundredths of a scene unit (default 4; 0: no stroke).
background_stroke_colorThe color of an outline drawn behind the fill (default black).
background_stroke_opacityThe outline's opacity, from 0 to 1 (default 1).
background_stroke_widthThe outline's width, in hundredths of a scene unit (default 0: none).
sheen_factorHow much the colors lighten toward
sheen_direction, from -1 to 1 (default 0); a negative factor darkens.sheen_directionThe direction the colors lighten toward (default
UL).joint_typeHow the stroke is joined where its path turns: round, beveled or mitered, as a two-dimensional scene draws it (see LineJointType; default AUTO: mitered).
cap_styleHow the stroke ends, at each end it shows (an open path's, a dash's): round, butt or square, as a two-dimensional scene draws it (see CapStyleType; default AUTO: butt).
shade_in_3dWhether a three-dimensional scene's light shades the mobject.
materialHow its surface reflects the scene's lights in a three-dimensional scene (see Material); None: Manim's shading (default).
nameA name for the mobject; its class's name if not given.
z_indexIts place in the drawing order: a higher index is drawn over a lower one (default 0).
targetThe state
MoveToTargetmoves the mobject to.
It also takes the style keywords.
Source
src/manimgx/mobjects/grid.py
Table ¶

Code
import manimgx as m
class TableExample(m.Scene):
def construct(self) -> None:
table = m.Table(
[["1", "2", "3"], ["2", "4", "6"], ["3", "6", "9"]],
row_labels=[m.Text("1"), m.Text("2"), m.Text("3")],
col_labels=[m.Text("1"), m.Text("2"), m.Text("3")],
top_left_entry=m.Text("×"),
include_outer_lines=True,
line_config={"color": m.BLUE},
)
self.add(table)
A table: entries in rows and columns, with lines between them, and labels for the rows and the columns if given; white unless styled.
Each entry is made into a mobject by element_to_mobject — by default a
Paragraph of its text — and the cells are laid out in a grid,
each entry centered in its cell (see
arrange_in_grid); the table is centered on the
scene's origin. Row labels make a first column, column labels a first row, and
top_left_entry fills the corner between them. The lines run through the middle of
the gaps between rows and between columns, and half a gap beyond the entries. Its
rows and columns can be reached as groups, get_rows() and get_columns(), and
colored, set_row_colors(...) and set_column_colors(...), labels included.
A cell is addressed by its position, (row, column), counted from 1 at the top
left, labels included: in a table with row and column labels, (1, 1) is the corner
and the first entry is at (2, 2).
Grid, line and background options are consumed during construction; cells, labels, line groups and gaps hold the table's state.
m.Table(table, row_labels=None, col_labels=None, top_left_entry=None, v_buff=0.8, h_buff=1.3, include_outer_lines=False, include_inner_lines=True, add_background_rectangles_to_entries=False, entries_background_color=BLACK, include_background_rectangle=False, background_rectangle_color=BLACK, element_to_mobject=None, element_to_mobject_config=None, arrange_in_grid_config=None, line_config=None, **kwargs)
tableThe entries, row by row, every row as long: strings, for the default Paragraph; numbers or mobjects, as another
element_to_mobjecttakes them.row_labelsA label for each row, left of it; None for none.
col_labelsA label for each column, above it; None for none.
top_left_entryA mobject for the corner above the row labels and left of the column labels, when there are both; None to leave it empty.
v_buffThe gap between rows, in scene units.
h_buffThe gap between columns, in scene units.
include_outer_linesWhether lines frame the table.
include_inner_linesWhether lines separate its rows and its columns.
add_background_rectangles_to_entriesWhether each entry, labels included, gets a background rectangle (see add_background_to_entries).
entries_background_colorThe color of the entries' background rectangles.
include_background_rectangleWhether the table gets a background rectangle (see add_background_rectangle).
background_rectangle_colorThe color of the table's background rectangle.
element_to_mobjectThe function that makes each entry's mobject, called with the entry and the keywords of
element_to_mobject_config: a class, as MathTex, or any function; None for the class's own (Paragraph, for a Table).element_to_mobject_configKeywords for
element_to_mobject; None for the class's own (none, for a Table).arrange_in_grid_configGrid keywords for laying out the cells, over the table's own rows, columns and gaps:
cell_alignment,col_alignments, …; None for none.line_configLine keywords for the lines: their
color,stroke_width, …; None for none.colorThe color of both fill and stroke (default white); None for the class's default.
fill_colorThe fill's color;
colorif not given. Several colors make a gradient alongsheen_direction.fill_opacityThe fill's opacity, from 0 to 1 (default 0: no fill).
stroke_colorThe stroke's color;
colorif not given. Several colors make a gradient.stroke_opacityThe stroke's opacity, from 0 to 1 (default 1).
stroke_widthThe stroke's width, in hundredths of a scene unit (default 4; 0: no stroke).
background_stroke_colorThe color of an outline drawn behind the fill (default black).
background_stroke_opacityThe outline's opacity, from 0 to 1 (default 1).
background_stroke_widthThe outline's width, in hundredths of a scene unit (default 0: none).
sheen_factorHow much the colors lighten toward
sheen_direction, from -1 to 1 (default 0); a negative factor darkens.sheen_directionThe direction the colors lighten toward (default
UL).joint_typeHow the stroke is joined where its path turns: round, beveled or mitered, as a two-dimensional scene draws it (see LineJointType; default AUTO: mitered).
cap_styleHow the stroke ends, at each end it shows (an open path's, a dash's): round, butt or square, as a two-dimensional scene draws it (see CapStyleType; default AUTO: butt).
shade_in_3dWhether a three-dimensional scene's light shades the mobject.
materialHow its surface reflects the scene's lights in a three-dimensional scene (see Material); None: Manim's shading (default).
nameA name for the mobject; its class's name if not given.
z_indexIts place in the drawing order: a higher index is drawn over a lower one (default 0).
targetThe state
MoveToTargetmoves the mobject to.
It also takes the style keywords.
Source
src/manimgx/mobjects/grid.py
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | |
entry_config ¶
The keywords entry is called with when the constructor is given no
element_to_mobject_config (none, unless a subclass sets them).
row_labels ¶
The row labels, top to bottom; None if there are none.
col_labels ¶
The column labels, left to right; None if there are none.
top_left_entry ¶
The mobject in the corner between the labels; None if there is none.
row_dim ¶
How many rows of entries the table has, labels not counted.
col_dim ¶
How many columns of entries the table has, labels not counted.
v_buff ¶
The gap between rows, in scene units, as the table was made: scaling the table leaves it as it is.
h_buff ¶
The gap between columns, in scene units, as the table was made: scaling the table leaves it as it is.
elements_without_labels ¶
The entries but the labels, row by row.
elements ¶
Every entry of the table, labels included, row by row: a group, added to the table.
get_rows ¶
The rows, from the top down, each a group of its entries from left to right (a table's labels included).
Returns A new group of the rows.
Source
src/manimgx/mobjects/grid.py
get_columns ¶
Code
import manimgx as m
class TableGetColumnsExample(m.Scene):
def construct(self) -> None:
table = m.Table(
[["First", "Second"], ["Third", "Fourth"]],
row_labels=[m.Text("R1"), m.Text("R2")],
col_labels=[m.Text("C1"), m.Text("C2")],
)
column = m.SurroundingRectangle(table.get_columns()[1])
self.add(table)
self.play(m.Create(column))
The columns, from left to right, each a group of its entries from the top down (a table's labels included).
Returns A new group of the columns.
Source
src/manimgx/mobjects/grid.py
set_row_colors ¶

Color the rows, from the top down: each one color, or several for a gradient (as set_color makes one); rows past the last color keep theirs.
*colorsThe rows' colors, in order: a color each, or a list of colors.
Source
src/manimgx/mobjects/grid.py
set_column_colors ¶

Code
Color the columns, from left to right: each one color, or several for a gradient (as set_color makes one); columns past the last color keep theirs.
*colorsThe columns' colors, in order: a color each, or a list of colors.
Source
src/manimgx/mobjects/grid.py
get_horizontal_lines ¶
Code
import manimgx as m
class TableGetHorizontalLinesExample(m.Scene):
def construct(self) -> None:
table = m.Table(
[["First", "Second"], ["Third", "Fourth"]],
row_labels=[m.Text("R1"), m.Text("R2")],
col_labels=[m.Text("C1"), m.Text("C2")],
include_outer_lines=True,
)
self.add(table)
self.play(table.get_horizontal_lines().animate.set_color(m.RED))
The table's horizontal lines: the outer ones first, top then bottom, if it has them, then those between its rows, from the top down.
Returns The group of the lines.
Source
src/manimgx/mobjects/grid.py
get_vertical_lines ¶
The table's vertical lines: the outer ones first, left then right, if it has them, then those between its columns, from left to right.
Returns The group of the lines.
Source
src/manimgx/mobjects/grid.py
get_entries ¶
Code
import manimgx as m
class TableGetEntriesExample(m.Scene):
def construct(self) -> None:
table = m.Table(
[["First", "Second"], ["Third", "Fourth"]],
row_labels=[m.Text("R1"), m.Text("R2")],
col_labels=[m.Text("C1"), m.Text("C2")],
)
self.add(table)
self.play(table.get_entries((2, 3)).animate.set_color(m.YELLOW))
self.play(m.Rotate(table.get_entries((3, 2)), m.PI))
The table's entries, labels included, or the one at a position.
posThe position,
(row, column), counted from 1 at the top left, labels included; None for every entry.
Returns The entry; or every entry, row by row, in a group.
Source
src/manimgx/mobjects/grid.py
get_entries_without_labels ¶

Code
import manimgx as m
class TableGetEntriesWithoutLabelsExample(m.Scene):
def construct(self) -> None:
table = m.Table(
[["First", "Second"], ["Third", "Fourth"]],
row_labels=[m.Text("R1"), m.Text("R2")],
col_labels=[m.Text("C1"), m.Text("C2")],
)
entries = table.get_entries_without_labels()
colors = [m.BLUE, m.GREEN, m.YELLOW, m.RED]
for entry, color in zip(entries, colors):
entry.set_color(color)
self.add(table)
The table's entries but its labels, or the one at a position among them.
posThe position,
(row, column), counted from 1 at the top left entry that is not a label; None for every such entry.
Returns The entry; or every entry but the labels, row by row, in a group.
Source
src/manimgx/mobjects/grid.py
get_row_labels ¶
The table's row labels, from the top down.
Returns A new group of the labels; empty if there are none.
get_col_labels ¶
The table's column labels, from left to right.
Returns A new group of the labels; empty if there are none.
Source
src/manimgx/mobjects/grid.py
get_labels ¶
Code
import manimgx as m
class TableGetLabelsExample(m.Scene):
def construct(self) -> None:
table = m.Table(
[["First", "Second"], ["Third", "Fourth"]],
row_labels=[m.Text("R1"), m.Text("R2")],
col_labels=[m.Text("C1"), m.Text("C2")],
)
self.add(table)
self.play(table.get_labels().animate.set_color(m.YELLOW))
The table's labels: its top left entry, if it has one, then its column labels, then its row labels.
Returns A new group of the labels; empty if there are none.
Source
src/manimgx/mobjects/grid.py
add_background_to_entries ¶
Put a background rectangle behind each entry, labels included (see add_background_rectangle).
The rectangles are the entries' background_rectangles:
create fades in those of the entries but the labels.
colorThe rectangles' color.
Source
src/manimgx/mobjects/grid.py
get_cell ¶
Code
import manimgx as m
class TableGetCellExample(m.Scene):
def construct(self) -> None:
table = m.Table(
[["First", "Second"], ["Third", "Fourth"]],
row_labels=[m.Text("R1"), m.Text("R2")],
col_labels=[m.Text("C1"), m.Text("C2")],
)
self.add(table)
self.play(m.Create(table.get_cell((2, 2), color=m.RED)))
Make the rectangle of a cell: its row's height and its column's width, reaching half a gap beyond them on every side, so that it meets the lines; blue unless styled.
The gaps are v_buff and h_buff, as the table was made: on a table scaled
since, the rectangle reaches as far beyond the entries as before.
posThe cell's position,
(row, column), counted from 1 at the top left, labels included.colorThe color of both fill and stroke (default white); None for the class's default.
fill_colorThe fill's color;
colorif not given. Several colors make a gradient alongsheen_direction.fill_opacityThe fill's opacity, from 0 to 1 (default 0: no fill).
stroke_colorThe stroke's color;
colorif not given. Several colors make a gradient.stroke_opacityThe stroke's opacity, from 0 to 1 (default 1).
stroke_widthThe stroke's width, in hundredths of a scene unit (default 4; 0: no stroke).
background_stroke_colorThe color of an outline drawn behind the fill (default black).
background_stroke_opacityThe outline's opacity, from 0 to 1 (default 1).
background_stroke_widthThe outline's width, in hundredths of a scene unit (default 0: none).
sheen_factorHow much the colors lighten toward
sheen_direction, from -1 to 1 (default 0); a negative factor darkens.sheen_directionThe direction the colors lighten toward (default
UL).joint_typeHow the stroke is joined where its path turns: round, beveled or mitered, as a two-dimensional scene draws it (see LineJointType; default AUTO: mitered).
cap_styleHow the stroke ends, at each end it shows (an open path's, a dash's): round, butt or square, as a two-dimensional scene draws it (see CapStyleType; default AUTO: butt).
shade_in_3dWhether a three-dimensional scene's light shades the mobject.
materialHow its surface reflects the scene's lights in a three-dimensional scene (see Material); None: Manim's shading (default).
nameA name for the mobject; its class's name if not given.
z_indexIts place in the drawing order: a higher index is drawn over a lower one (default 0).
targetThe state
MoveToTargetmoves the mobject to.
It also takes the style keywords.
Returns A new Polygon, not added to the table.
Source
src/manimgx/mobjects/grid.py
get_highlighted_cell ¶
Make a highlight for a cell: a
BackgroundRectangle over the
cell's rectangle, bright yellow (PURE_YELLOW) unless
given a color.
It is not added to the table: put it behind the entries, as add_highlighted_cell does.
posThe cell's position,
(row, column), counted from 1 at the top left, labels included.buffThe margin around the mobject, in scene units: one for all sides, or (horizontal, vertical) (default 0.1 around a surrounding rectangle, 0 behind a background rectangle).
corner_radiusThe radius of the rectangle's corners, in scene units (default 0: square corners).
colorThe color of both fill and stroke (default white); None for the class's default.
fill_colorThe fill's color;
colorif not given. Several colors make a gradient alongsheen_direction.fill_opacityThe fill's opacity, from 0 to 1 (default 0: no fill).
stroke_colorThe stroke's color;
colorif not given. Several colors make a gradient.stroke_opacityThe stroke's opacity, from 0 to 1 (default 1).
stroke_widthThe stroke's width, in hundredths of a scene unit (default 4; 0: no stroke).
background_stroke_colorThe color of an outline drawn behind the fill (default black).
background_stroke_opacityThe outline's opacity, from 0 to 1 (default 1).
background_stroke_widthThe outline's width, in hundredths of a scene unit (default 0: none).
sheen_factorHow much the colors lighten toward
sheen_direction, from -1 to 1 (default 0); a negative factor darkens.sheen_directionThe direction the colors lighten toward (default
UL).joint_typeHow the stroke is joined where its path turns: round, beveled or mitered, as a two-dimensional scene draws it (see LineJointType; default AUTO: mitered).
cap_styleHow the stroke ends, at each end it shows (an open path's, a dash's): round, butt or square, as a two-dimensional scene draws it (see CapStyleType; default AUTO: butt).
shade_in_3dWhether a three-dimensional scene's light shades the mobject.
materialHow its surface reflects the scene's lights in a three-dimensional scene (see Material); None: Manim's shading (default).
nameA name for the mobject; its class's name if not given.
z_indexIts place in the drawing order: a higher index is drawn over a lower one (default 0).
targetThe state
MoveToTargetmoves the mobject to.
Returns A new background rectangle.
Source
src/manimgx/mobjects/grid.py
add_highlighted_cell ¶

Code
import manimgx as m
class TableAddHighlightedCellExample(m.Scene):
def construct(self) -> None:
table = m.Table(
[["First", "Second"], ["Third", "Fourth"]],
row_labels=[m.Text("R1"), m.Text("R2")],
col_labels=[m.Text("C1"), m.Text("C2")],
)
table.add_highlighted_cell((2, 2), color=m.GREEN)
self.add(table)
Highlight a cell: put a highlight behind everything in the table.
The highlight is the background_rectangle of the entry at pos:
create fades it in, unless the entry is a label.
posThe cell's position,
(row, column), counted from 1 at the top left, labels included.buffThe margin around the mobject, in scene units: one for all sides, or (horizontal, vertical) (default 0.1 around a surrounding rectangle, 0 behind a background rectangle).
corner_radiusThe radius of the rectangle's corners, in scene units (default 0: square corners).
colorThe color of both fill and stroke (default white); None for the class's default.
fill_colorThe fill's color;
colorif not given. Several colors make a gradient alongsheen_direction.fill_opacityThe fill's opacity, from 0 to 1 (default 0: no fill).
stroke_colorThe stroke's color;
colorif not given. Several colors make a gradient.stroke_opacityThe stroke's opacity, from 0 to 1 (default 1).
stroke_widthThe stroke's width, in hundredths of a scene unit (default 4; 0: no stroke).
background_stroke_colorThe color of an outline drawn behind the fill (default black).
background_stroke_opacityThe outline's opacity, from 0 to 1 (default 1).
background_stroke_widthThe outline's width, in hundredths of a scene unit (default 0: none).
sheen_factorHow much the colors lighten toward
sheen_direction, from -1 to 1 (default 0); a negative factor darkens.sheen_directionThe direction the colors lighten toward (default
UL).joint_typeHow the stroke is joined where its path turns: round, beveled or mitered, as a two-dimensional scene draws it (see LineJointType; default AUTO: mitered).
cap_styleHow the stroke ends, at each end it shows (an open path's, a dash's): round, butt or square, as a two-dimensional scene draws it (see CapStyleType; default AUTO: butt).
shade_in_3dWhether a three-dimensional scene's light shades the mobject.
materialHow its surface reflects the scene's lights in a three-dimensional scene (see Material); None: Manim's shading (default).
nameA name for the mobject; its class's name if not given.
z_indexIts place in the drawing order: a higher index is drawn over a lower one (default 0).
targetThe state
MoveToTargetmoves the mobject to.
Source
src/manimgx/mobjects/grid.py
create ¶
Code
import manimgx as m
class TableCreateExample(m.Scene):
def construct(self) -> None:
table = m.Table(
[["First", "Second"], ["Third", "Fourth"]],
row_labels=[m.Text("R1"), m.Text("R2")],
col_labels=[m.Text("C1"), m.Text("C2")],
include_outer_lines=True,
)
table.add_highlighted_cell((2, 2), color=m.GREEN)
self.play(table.create())
Make an animation that builds the table: its lines, then its entries, then its labels, then each entry's background rectangle, one after another.
Each part is its own animation, made with the options given; the parts follow
one another by lag_ratio, 1 unless given. The entries but the labels are
moved to a z-index of 2, over backgrounds and highlights.
line_animationThe animation that draws the lines.
label_animationThe animation that draws the labels.
element_animationThe animation that draws the entries but the labels.
entry_animationThe animation that brings in each entry's background rectangle (the highlights of add_highlighted_cell).
run_timeHow long the animation plays, in seconds (default 1).
lag_ratioHow the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).
rate_funcHow the animation's progress runs with time: a function from [0, 1] to [0, 1] (default
smooth; see rate functions).reverse_rate_functionWhether to run the animation backward (default False).
nameA name for the animation.
removerWhether the mobject leaves the scene when the animation finishes (default False).
suspend_mobject_updatingWhether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.
introducerWhether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.
use_overrideWhether a mobject whose class plays another animation in place of this one does so (default True).
It also takes the animation keywords.
Returns A new animation group.
Source
src/manimgx/mobjects/grid.py
DecimalTable ¶

Code
A table of decimal numbers: each entry written as a DecimalNumber, with one decimal place unless configured.
It takes a Table's arguments; its entries are numbers, and its
element_to_mobject_config gives their
number keywords, in place of
{"num_decimal_places": 1}.
m.DecimalTable(table, row_labels=None, col_labels=None, top_left_entry=None, v_buff=0.8, h_buff=1.3, include_outer_lines=False, include_inner_lines=True, add_background_rectangles_to_entries=False, entries_background_color=BLACK, include_background_rectangle=False, background_rectangle_color=BLACK, element_to_mobject=None, element_to_mobject_config=None, arrange_in_grid_config=None, line_config=None, **kwargs)
colorThe color of both fill and stroke (default white); None for the class's default.
fill_colorThe fill's color;
colorif not given. Several colors make a gradient alongsheen_direction.fill_opacityThe fill's opacity, from 0 to 1 (default 0: no fill).
stroke_colorThe stroke's color;
colorif not given. Several colors make a gradient.stroke_opacityThe stroke's opacity, from 0 to 1 (default 1).
stroke_widthThe stroke's width, in hundredths of a scene unit (default 4; 0: no stroke).
background_stroke_colorThe color of an outline drawn behind the fill (default black).
background_stroke_opacityThe outline's opacity, from 0 to 1 (default 1).
background_stroke_widthThe outline's width, in hundredths of a scene unit (default 0: none).
sheen_factorHow much the colors lighten toward
sheen_direction, from -1 to 1 (default 0); a negative factor darkens.sheen_directionThe direction the colors lighten toward (default
UL).joint_typeHow the stroke is joined where its path turns: round, beveled or mitered, as a two-dimensional scene draws it (see LineJointType; default AUTO: mitered).
cap_styleHow the stroke ends, at each end it shows (an open path's, a dash's): round, butt or square, as a two-dimensional scene draws it (see CapStyleType; default AUTO: butt).
shade_in_3dWhether a three-dimensional scene's light shades the mobject.
materialHow its surface reflects the scene's lights in a three-dimensional scene (see Material); None: Manim's shading (default).
nameA name for the mobject; its class's name if not given.
z_indexIts place in the drawing order: a higher index is drawn over a lower one (default 0).
targetThe state
MoveToTargetmoves the mobject to.
It also takes the style keywords.
Source
src/manimgx/mobjects/grid.py
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | |
IntegerTable ¶

A table of integers: each entry written as an Integer, its number rounded to a whole number.
It takes a Table's arguments; its entries are numbers, and its
element_to_mobject_config gives their
number keywords.
m.IntegerTable(table, row_labels=None, col_labels=None, top_left_entry=None, v_buff=0.8, h_buff=1.3, include_outer_lines=False, include_inner_lines=True, add_background_rectangles_to_entries=False, entries_background_color=BLACK, include_background_rectangle=False, background_rectangle_color=BLACK, element_to_mobject=None, element_to_mobject_config=None, arrange_in_grid_config=None, line_config=None, **kwargs)
colorThe color of both fill and stroke (default white); None for the class's default.
fill_colorThe fill's color;
colorif not given. Several colors make a gradient alongsheen_direction.fill_opacityThe fill's opacity, from 0 to 1 (default 0: no fill).
stroke_colorThe stroke's color;
colorif not given. Several colors make a gradient.stroke_opacityThe stroke's opacity, from 0 to 1 (default 1).
stroke_widthThe stroke's width, in hundredths of a scene unit (default 4; 0: no stroke).
background_stroke_colorThe color of an outline drawn behind the fill (default black).
background_stroke_opacityThe outline's opacity, from 0 to 1 (default 1).
background_stroke_widthThe outline's width, in hundredths of a scene unit (default 0: none).
sheen_factorHow much the colors lighten toward
sheen_direction, from -1 to 1 (default 0); a negative factor darkens.sheen_directionThe direction the colors lighten toward (default
UL).joint_typeHow the stroke is joined where its path turns: round, beveled or mitered, as a two-dimensional scene draws it (see LineJointType; default AUTO: mitered).
cap_styleHow the stroke ends, at each end it shows (an open path's, a dash's): round, butt or square, as a two-dimensional scene draws it (see CapStyleType; default AUTO: butt).
shade_in_3dWhether a three-dimensional scene's light shades the mobject.
materialHow its surface reflects the scene's lights in a three-dimensional scene (see Material); None: Manim's shading (default).
nameA name for the mobject; its class's name if not given.
z_indexIts place in the drawing order: a higher index is drawn over a lower one (default 0).
targetThe state
MoveToTargetmoves the mobject to.
It also takes the style keywords.
Source
src/manimgx/mobjects/grid.py
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | |
MathTable ¶

A table of math: each entry typeset as math, with MathTex.
It takes a Table's arguments; its entries are strings of math, or
numbers, and its element_to_mobject_config gives their
math keywords.
m.MathTable(table, row_labels=None, col_labels=None, top_left_entry=None, v_buff=0.8, h_buff=1.3, include_outer_lines=False, include_inner_lines=True, add_background_rectangles_to_entries=False, entries_background_color=BLACK, include_background_rectangle=False, background_rectangle_color=BLACK, element_to_mobject=None, element_to_mobject_config=None, arrange_in_grid_config=None, line_config=None, **kwargs)
colorThe color of both fill and stroke (default white); None for the class's default.
fill_colorThe fill's color;
colorif not given. Several colors make a gradient alongsheen_direction.fill_opacityThe fill's opacity, from 0 to 1 (default 0: no fill).
stroke_colorThe stroke's color;
colorif not given. Several colors make a gradient.stroke_opacityThe stroke's opacity, from 0 to 1 (default 1).
stroke_widthThe stroke's width, in hundredths of a scene unit (default 4; 0: no stroke).
background_stroke_colorThe color of an outline drawn behind the fill (default black).
background_stroke_opacityThe outline's opacity, from 0 to 1 (default 1).
background_stroke_widthThe outline's width, in hundredths of a scene unit (default 0: none).
sheen_factorHow much the colors lighten toward
sheen_direction, from -1 to 1 (default 0); a negative factor darkens.sheen_directionThe direction the colors lighten toward (default
UL).joint_typeHow the stroke is joined where its path turns: round, beveled or mitered, as a two-dimensional scene draws it (see LineJointType; default AUTO: mitered).
cap_styleHow the stroke ends, at each end it shows (an open path's, a dash's): round, butt or square, as a two-dimensional scene draws it (see CapStyleType; default AUTO: butt).
shade_in_3dWhether a three-dimensional scene's light shades the mobject.
materialHow its surface reflects the scene's lights in a three-dimensional scene (see Material); None: Manim's shading (default).
nameA name for the mobject; its class's name if not given.
z_indexIts place in the drawing order: a higher index is drawn over a lower one (default 0).
targetThe state
MoveToTargetmoves the mobject to.
It also takes the style keywords.
Source
src/manimgx/mobjects/grid.py
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | |
MobjectTable ¶

Code
import manimgx as m
class MobjectTableExample(m.Scene):
def construct(self) -> None:
def o() -> m.Circle:
return m.Circle(radius=0.45, color=m.RED)
def x() -> m.VGroup:
cross = m.VGroup(m.Line(m.UL, m.DR), m.Line(m.UR, m.DL))
return cross.scale(0.45).set_color(m.BLUE)
table = m.MobjectTable(
[[o(), x(), o()], [x(), o(), o()], [o(), x(), x()]]
)
self.add(table)
A table of mobjects: each entry a mobject, placed as it is.
It takes a Table's arguments; its entries are mobjects, used themselves (not copied).
m.MobjectTable(table, row_labels=None, col_labels=None, top_left_entry=None, v_buff=0.8, h_buff=1.3, include_outer_lines=False, include_inner_lines=True, add_background_rectangles_to_entries=False, entries_background_color=BLACK, include_background_rectangle=False, background_rectangle_color=BLACK, element_to_mobject=None, element_to_mobject_config=None, arrange_in_grid_config=None, line_config=None, **kwargs)
colorThe color of both fill and stroke (default white); None for the class's default.
fill_colorThe fill's color;
colorif not given. Several colors make a gradient alongsheen_direction.fill_opacityThe fill's opacity, from 0 to 1 (default 0: no fill).
stroke_colorThe stroke's color;
colorif not given. Several colors make a gradient.stroke_opacityThe stroke's opacity, from 0 to 1 (default 1).
stroke_widthThe stroke's width, in hundredths of a scene unit (default 4; 0: no stroke).
background_stroke_colorThe color of an outline drawn behind the fill (default black).
background_stroke_opacityThe outline's opacity, from 0 to 1 (default 1).
background_stroke_widthThe outline's width, in hundredths of a scene unit (default 0: none).
sheen_factorHow much the colors lighten toward
sheen_direction, from -1 to 1 (default 0); a negative factor darkens.sheen_directionThe direction the colors lighten toward (default
UL).joint_typeHow the stroke is joined where its path turns: round, beveled or mitered, as a two-dimensional scene draws it (see LineJointType; default AUTO: mitered).
cap_styleHow the stroke ends, at each end it shows (an open path's, a dash's): round, butt or square, as a two-dimensional scene draws it (see CapStyleType; default AUTO: butt).
shade_in_3dWhether a three-dimensional scene's light shades the mobject.
materialHow its surface reflects the scene's lights in a three-dimensional scene (see Material); None: Manim's shading (default).
nameA name for the mobject; its class's name if not given.
z_indexIts place in the drawing order: a higher index is drawn over a lower one (default 0).
targetThe state
MoveToTargetmoves the mobject to.
It also takes the style keywords.
Source
src/manimgx/mobjects/grid.py
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | |