From 8179ba88d01c6da468a9cd64405abd181f5bc1fc Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Thu, 18 Jan 2024 11:13:12 -0600 Subject: [PATCH] Reformat defaults for n_rows and n_cols in Mobject.arrange_in_grid --- manimlib/mobject/mobject.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/manimlib/mobject/mobject.py b/manimlib/mobject/mobject.py index bca93026..2c9a781d 100644 --- a/manimlib/mobject/mobject.py +++ b/manimlib/mobject/mobject.py @@ -495,12 +495,11 @@ class Mobject(object): fill_rows_first: bool = True ) -> Self: submobs = self.submobjects - if n_rows is None and n_cols is None: - n_rows = int(np.sqrt(len(submobs))) + n_submobs = len(submobs) if n_rows is None: - n_rows = len(submobs) // n_cols + n_rows = int(np.sqrt(n_submobs)) if n_cols is None else n_submobs // n_cols if n_cols is None: - n_cols = len(submobs) // n_rows + n_cols = n_submobs // n_rows if buff is not None: h_buff = buff