Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Fixed the positioning of line graph that was under the graph (#1951)

Václav Hlaváč02446b3e7e4d
diff --git a/manim/mobject/coordinate_systems.py b/manim/mobject/coordinate_systems.py
index 91c24e75b..b6aa51d45 100644
--- a/manim/mobject/coordinate_systems.py
+++ b/manim/mobject/coordinate_systems.py
@@ -1255,7 +1255,6 @@ class Axes(VGroup, CoordinateSystem, metaclass=ConvertToOpenGL):
for x, y, z in zip(x_values, y_values, z_values)
]
graph.set_points_as_corners(vertices)
- graph.z_index = -1
line_graph["line_graph"] = graph
if add_vertex_dots:
diff --git a/tests/control_data/graphical_units_data/coordinate_system/line_graph.npz b/tests/control_data/graphical_units_data/coordinate_system/line_graph.npz
new file mode 100644
index 000000000..ad2a00d36
Binary files /dev/null and b/tests/control_data/graphical_units_data/coordinate_system/line_graph.npz differ
diff --git a/tests/test_graphical_units/test_coordinate_systems.py b/tests/test_graphical_units/test_coordinate_systems.py
index 53fb0b73f..f4839a29a 100644
--- a/tests/test_graphical_units/test_coordinate_systems.py
+++ b/tests/test_graphical_units/test_coordinate_systems.py
@@ -16,3 +16,16 @@ def test_number_plane(scene):
)
scene.add(plane)
+
+
+@frames_comparison
+def test_line_graph(scene):
+ plane = NumberPlane()
+ first_line = plane.get_line_graph(
+ x_values=[-3, 1], y_values=[-2, 2], line_color=YELLOW
+ )
+ second_line = plane.get_line_graph(
+ x_values=[0, 2, 2, 4], y_values=[0, 0, 2, 4], line_color=RED
+ )
+
+ scene.add(plane, first_line, second_line)