add_background_rectangles -> add_background_rectangles_to_entries

This commit is contained in:
Grant Sanderson
2018-04-26 17:11:00 -07:00
parent b88a7e8d71
commit 0da1abc689
3 changed files with 7 additions and 6 deletions

View File

@ -40,7 +40,7 @@ def vector_coordinate_label(vector_mob, integer_labels=True,
vect = np.round(vect).astype(int)
vect = vect[:n_dim]
vect = vect.reshape((n_dim, 1))
label = Matrix(vect, add_background_rectangles=True)
label = Matrix(vect, add_background_rectangles_to_entries=True)
label.scale(VECTOR_LABEL_SCALE_FACTOR)
shift_dir = np.array(vector_mob.get_end())
@ -59,7 +59,7 @@ class Matrix(VMobject):
CONFIG = {
"v_buff": 0.8,
"h_buff": 1.3,
"add_background_rectangles": False,
"add_background_rectangles_to_entries": False,
"element_to_mobject": TexMobject,
"element_to_mobject_config": {},
"element_alignment_corner": DR,
@ -82,14 +82,15 @@ class Matrix(VMobject):
self.center()
self.mob_matrix = mob_matrix
if self.add_background_rectangles:
if self.add_background_rectangles_to_entries:
for mob in self.elements:
mob.add_background_rectangle()
def matrix_to_mob_matrix(self, matrix):
return np.vectorize(
lambda e: self.element_to_mobject(
e, **self.element_to_mobject_config)
e, **self.element_to_mobject_config
)
)(matrix)
def organize_mob_matrix(self, matrix):

View File

@ -887,7 +887,7 @@ class MatrixVectorMultiplication(LinearTransformationScene):
)
concrete_matrix = Matrix(
copy.deepcopy(abstract_matrix),
add_background_rectangles = True
add_background_rectangles_to_entries = True
)
concrete_matrix.to_edge(UP)
if self.abstract:

View File

@ -106,7 +106,7 @@ class FollowLinearCombination(LinearTransformationScene):
direction = "right", color = Y_COLOR
)
vect = self.add_vector(vect_coords)
vect_array = Matrix(["x", "y"], add_background_rectangles = True)
vect_array = Matrix(["x", "y"], add_background_rectangles_to_entries = True)
v_equals = TexMobject(["\\vec{\\textbf{v}}", "="])
v_equals.split()[0].set_color(YELLOW)
v_equals.next_to(vect_array, LEFT)