From 62f246a3d97df7721677ca17045d7b0d5a35b510 Mon Sep 17 00:00:00 2001 From: csoapyhands-gif Date: Fri, 20 Mar 2026 11:55:20 +0400 Subject: [PATCH 1/6] fix: fixes unit_size not working in Axes --- manim/mobject/graphing/coordinate_systems.py | 14 ++++++++++++-- manim/utils/deprecation.py | 8 +++++--- manim/utils/file_ops.py | 2 +- my-project/main.py | 14 ++++++++++++++ my-project/manim.cfg | 7 +++++++ 5 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 my-project/main.py create mode 100644 my-project/manim.cfg diff --git a/manim/mobject/graphing/coordinate_systems.py b/manim/mobject/graphing/coordinate_systems.py index 6b8237827f..ad99a3d627 100644 --- a/manim/mobject/graphing/coordinate_systems.py +++ b/manim/mobject/graphing/coordinate_systems.py @@ -1932,8 +1932,8 @@ def __init__( self, x_range: Sequence[float] | None = None, y_range: Sequence[float] | None = None, - x_length: float | None = round(config.frame_width) - 2, - y_length: float | None = round(config.frame_height) - 2, + x_length: float | None = None, + y_length: float | None = None, axis_config: dict | None = None, x_axis_config: dict | None = None, y_axis_config: dict | None = None, @@ -1989,6 +1989,16 @@ def __init__( else: self.y_axis_config["exclude_origin_tick"] = False + if "unit_size" in self.x_axis_config: + x_length = self.x_axis_config["unit_size"] + else: + x_length = round(config.frame_width) - 2 + + if "unit_size" in y_axis_config: + y_length = self.y_axis_config["unit_size"] + else: + y_length = round(config.frame_width) - 2 + self.x_axis = self._create_axis(self.x_range, self.x_axis_config, self.x_length) self.y_axis = self._create_axis(self.y_range, self.y_axis_config, self.y_length) diff --git a/manim/utils/deprecation.py b/manim/utils/deprecation.py index 112c62fa5d..4a2f7b80d1 100644 --- a/manim/utils/deprecation.py +++ b/manim/utils/deprecation.py @@ -407,9 +407,11 @@ def foo(**kwargs): @deprecated_params( redirections=[ - lambda buff=1: {"buff_x": buff[0], "buff_y": buff[1]} - if isinstance(buff, tuple) - else {"buff_x": buff, "buff_y": buff} + lambda buff=1: ( + {"buff_x": buff[0], "buff_y": buff[1]} + if isinstance(buff, tuple) + else {"buff_x": buff, "buff_y": buff} + ) ] ) def foo(**kwargs): diff --git a/manim/utils/file_ops.py b/manim/utils/file_ops.py index 1e00c186da..3f56f37849 100644 --- a/manim/utils/file_ops.py +++ b/manim/utils/file_ops.py @@ -197,7 +197,7 @@ def open_file(file_path: Path, in_browser: bool = False) -> None: if current_os == "Windows": # The method os.startfile is only available in Windows, # ignoring type error caused by this. - os.startfile(file_path if not in_browser else file_path.parent) # type: ignore[attr-defined] + os.startfile(file_path if not in_browser else file_path.parent) else: if current_os == "Linux": commands = ["xdg-open"] diff --git a/my-project/main.py b/my-project/main.py new file mode 100644 index 0000000000..fe93003e40 --- /dev/null +++ b/my-project/main.py @@ -0,0 +1,14 @@ +from manim import * + + +class AxesBug(Scene): + def construct(self): + axes = Axes( + x_range=[-3, 3, 1], + y_range=[-6, 6, 2], + x_axis_config={"unit_size": 1.7}, + y_axis_config={ + # "unit_size": 0.3 + }, + ) + self.add(axes) diff --git a/my-project/manim.cfg b/my-project/manim.cfg new file mode 100644 index 0000000000..67047e1283 --- /dev/null +++ b/my-project/manim.cfg @@ -0,0 +1,7 @@ +[CLI] +frame_rate = 30 +pixel_height = 1900 +pixel_width = 1900 +background_color = BLACK +background_opacity = 1 +scene_names = Default From 2eb1da3333ae049c246973872f91fd70f63b134d Mon Sep 17 00:00:00 2001 From: csoapyhands-gif Date: Fri, 20 Mar 2026 12:22:44 +0400 Subject: [PATCH 2/6] Delete my-project/manim.cfg --- my-project/manim.cfg | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 my-project/manim.cfg diff --git a/my-project/manim.cfg b/my-project/manim.cfg deleted file mode 100644 index 67047e1283..0000000000 --- a/my-project/manim.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[CLI] -frame_rate = 30 -pixel_height = 1900 -pixel_width = 1900 -background_color = BLACK -background_opacity = 1 -scene_names = Default From 5bdd0bce475581c94e9a8e5037cc5e9e5e0131ab Mon Sep 17 00:00:00 2001 From: csoapyhands-gif Date: Fri, 20 Mar 2026 12:23:36 +0400 Subject: [PATCH 3/6] Delete my-project/main.py --- my-project/main.py | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 my-project/main.py diff --git a/my-project/main.py b/my-project/main.py deleted file mode 100644 index fe93003e40..0000000000 --- a/my-project/main.py +++ /dev/null @@ -1,14 +0,0 @@ -from manim import * - - -class AxesBug(Scene): - def construct(self): - axes = Axes( - x_range=[-3, 3, 1], - y_range=[-6, 6, 2], - x_axis_config={"unit_size": 1.7}, - y_axis_config={ - # "unit_size": 0.3 - }, - ) - self.add(axes) From 340828c4440ffb8a9205a3ea1bc63651001719fd Mon Sep 17 00:00:00 2001 From: csoapyhands-gif Date: Fri, 20 Mar 2026 12:24:49 +0400 Subject: [PATCH 4/6] Update file_ops.py --- manim/utils/file_ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manim/utils/file_ops.py b/manim/utils/file_ops.py index 3f56f37849..8b9e1b00f7 100644 --- a/manim/utils/file_ops.py +++ b/manim/utils/file_ops.py @@ -197,7 +197,7 @@ def open_file(file_path: Path, in_browser: bool = False) -> None: if current_os == "Windows": # The method os.startfile is only available in Windows, # ignoring type error caused by this. - os.startfile(file_path if not in_browser else file_path.parent) + os.startfile(file_path if not in_browser else file_path.parent) # type: ignore[attr-defined] else: if current_os == "Linux": commands = ["xdg-open"] From ffb78ed630c1b7ab3f5fea577f2b7bee4388e222 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 08:25:13 +0000 Subject: [PATCH 5/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- manim/utils/file_ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manim/utils/file_ops.py b/manim/utils/file_ops.py index 8b9e1b00f7..1e00c186da 100644 --- a/manim/utils/file_ops.py +++ b/manim/utils/file_ops.py @@ -197,7 +197,7 @@ def open_file(file_path: Path, in_browser: bool = False) -> None: if current_os == "Windows": # The method os.startfile is only available in Windows, # ignoring type error caused by this. - os.startfile(file_path if not in_browser else file_path.parent) # type: ignore[attr-defined] + os.startfile(file_path if not in_browser else file_path.parent) # type: ignore[attr-defined] else: if current_os == "Linux": commands = ["xdg-open"] From 1b7963bf2a3ca1d5279ecf66fc29c506371c1cf5 Mon Sep 17 00:00:00 2001 From: csoapyhands-gif Date: Fri, 20 Mar 2026 13:42:51 +0400 Subject: [PATCH 6/6] fix: ensure self.y_axis_config is used instead of y_axis_config --- manim/mobject/graphing/coordinate_systems.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manim/mobject/graphing/coordinate_systems.py b/manim/mobject/graphing/coordinate_systems.py index ad99a3d627..da4228fac5 100644 --- a/manim/mobject/graphing/coordinate_systems.py +++ b/manim/mobject/graphing/coordinate_systems.py @@ -1994,7 +1994,7 @@ def __init__( else: x_length = round(config.frame_width) - 2 - if "unit_size" in y_axis_config: + if "unit_size" in self.y_axis_config: y_length = self.y_axis_config["unit_size"] else: y_length = round(config.frame_width) - 2