Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Edited note on :class:`.NumberPlane` length and added another example (#2726)

Charalampos Georgioubd631f7fb0af
diff --git a/manim/mobject/graphing/coordinate_systems.py b/manim/mobject/graphing/coordinate_systems.py
index 90afe66aa..3cacbb83b 100644
--- a/manim/mobject/graphing/coordinate_systems.py
+++ b/manim/mobject/graphing/coordinate_systems.py
@@ -2228,8 +2228,8 @@ class NumberPlane(Axes):
.. note::
- If :attr:`x_length` or :attr:`y_length` are not defined, the plane automatically adjusts its lengths based
- on the :attr:`x_range` and :attr:`y_range` values to set the ``unit_size`` to 1.
+ If :attr:`x_length` or :attr:`y_length` are not defined, they are automatically calculated such that
+ one unit on each axis is one Manim unit long.
Examples
--------
@@ -2239,8 +2239,6 @@ class NumberPlane(Axes):
class NumberPlaneExample(Scene):
def construct(self):
number_plane = NumberPlane(
- x_range=[-10, 10, 1],
- y_range=[-10, 10, 1],
background_line_style={
"stroke_color": TEAL,
"stroke_width": 4,
@@ -2248,6 +2246,27 @@ class NumberPlane(Axes):
}
)
self.add(number_plane)
+
+ .. manim:: NumberPlaneScaled
+ :save_last_frame:
+
+ class NumberPlaneScaled(Scene):
+ def construct(self):
+ number_plane = NumberPlane(
+ x_range=(-4, 11, 1),
+ y_range=(-3, 3, 1),
+ x_length=5,
+ y_length=2,
+ ).move_to(LEFT*3)
+
+ number_plane_scaled_y = NumberPlane(
+ x_range=(-4, 11, 1),
+ x_length=5,
+ y_length=4,
+ ).move_to(RIGHT*3)
+
+ self.add(number_plane)
+ self.add(number_plane_scaled_y)
"""
def __init__(