Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Fix `NumberPlane` axis step (#2108)

icedcoffeeeea4d3c1a5cd85
diff --git a/manim/mobject/coordinate_systems.py b/manim/mobject/coordinate_systems.py
index fcf024682..a2ee48231 100644
--- a/manim/mobject/coordinate_systems.py
+++ b/manim/mobject/coordinate_systems.py
@@ -2109,14 +2109,14 @@ class NumberPlane(Axes):
x_lines1, x_lines2 = self._get_lines_parallel_to_axis(
x_axis,
y_axis,
- self.x_axis.x_step,
+ self.y_axis.x_step,
self.faded_line_ratio,
)
y_lines1, y_lines2 = self._get_lines_parallel_to_axis(
y_axis,
x_axis,
- self.y_axis.x_step,
+ self.x_axis.x_step,
self.faded_line_ratio,
)
diff --git a/tests/test_coordinate_system.py b/tests/test_coordinate_system.py
index b2cb60eba..bea3536c1 100644
--- a/tests/test_coordinate_system.py
+++ b/tests/test_coordinate_system.py
@@ -86,6 +86,10 @@ def test_NumberPlane():
assert len(plane.y_lines) == num_y_lines
assert len(plane.x_lines) == num_x_lines
+ plane = NumberPlane((-5, 5, 0.5), (-8, 8, 2)) # <- test for different step values
+ assert len(plane.x_lines) == 8
+ assert len(plane.y_lines) == 20
+
def test_point_to_coords():
ax = Axes(x_range=[0, 10, 2])