# MobjectMatrix#

Qualified name: manim.mobject.matrix.MobjectMatrix

class MobjectMatrix(matrix, element_to_mobject=<function MobjectMatrix.<lambda>>, **kwargs)[source]#

Bases: Matrix

A mobject that displays a matrix of mobject entries on the screen.

Examples

Example: MobjectMatrixExample

from manim import *

class MobjectMatrixExample(Scene):
def construct(self):
a = Circle().scale(0.3)
b = Square().scale(0.3)
c = MathTex("\pi").scale(2)
d = Star().scale(0.3)
m0 = MobjectMatrix([[a, b], [c, d]])

Parameters
• matrix – A numpy 2d array or list of lists.

• v_buff – Vertical distance between elements, by default 0.8.

• h_buff – Horizontal distance between elements, by default 1.3.

• bracket_h_buff – Distance of the brackets from the matrix, by default MED_SMALL_BUFF.

• bracket_v_buff – Height of the brackets, by default MED_SMALL_BUFF.

• add_background_rectangles_to_entriesTrue if should add backgraound rectangles to entries, by default False.

• include_background_rectangleTrue if should include background rectangle, by default False.

• element_to_mobject – The mobject class used to construct the elements, by default MathTex.

• element_to_mobject_config – Additional arguments to be passed to the constructor in element_to_mobject, by default {}.

• element_alignment_corner – The corner to which elements are aligned, by default DR.

• left_bracket – The left bracket type, by default "[".

• right_bracket – The right bracket type, by default "]".

• stretch_bracketsTrue if should stretch the brackets to fit the height of matrix contents, by default True.

• bracket_config – Additional arguments to be passed to MathTex when constructing the brackets.

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. sheen_factor stroke_color width The width of the mobject.