Skip to content

Commit bd631f7

Browse files
Charis02pre-commit-ci[bot]behackl
authored
Edited note on :class:.NumberPlane length and added another example (#2726)
* docs: edit note on lengths and add example for it * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update manim/mobject/graphing/coordinate_systems.py Co-authored-by: Benjamin Hackl <[email protected]> * Update manim/mobject/graphing/coordinate_systems.py Co-authored-by: Benjamin Hackl <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Benjamin Hackl <[email protected]>
1 parent 2dba485 commit bd631f7

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

manim/mobject/graphing/coordinate_systems.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,8 +2228,8 @@ class NumberPlane(Axes):
22282228
22292229
22302230
.. note::
2231-
If :attr:`x_length` or :attr:`y_length` are not defined, the plane automatically adjusts its lengths based
2232-
on the :attr:`x_range` and :attr:`y_range` values to set the ``unit_size`` to 1.
2231+
If :attr:`x_length` or :attr:`y_length` are not defined, they are automatically calculated such that
2232+
one unit on each axis is one Manim unit long.
22332233
22342234
Examples
22352235
--------
@@ -2239,15 +2239,34 @@ class NumberPlane(Axes):
22392239
class NumberPlaneExample(Scene):
22402240
def construct(self):
22412241
number_plane = NumberPlane(
2242-
x_range=[-10, 10, 1],
2243-
y_range=[-10, 10, 1],
22442242
background_line_style={
22452243
"stroke_color": TEAL,
22462244
"stroke_width": 4,
22472245
"stroke_opacity": 0.6
22482246
}
22492247
)
22502248
self.add(number_plane)
2249+
2250+
.. manim:: NumberPlaneScaled
2251+
:save_last_frame:
2252+
2253+
class NumberPlaneScaled(Scene):
2254+
def construct(self):
2255+
number_plane = NumberPlane(
2256+
x_range=(-4, 11, 1),
2257+
y_range=(-3, 3, 1),
2258+
x_length=5,
2259+
y_length=2,
2260+
).move_to(LEFT*3)
2261+
2262+
number_plane_scaled_y = NumberPlane(
2263+
x_range=(-4, 11, 1),
2264+
x_length=5,
2265+
y_length=4,
2266+
).move_to(RIGHT*3)
2267+
2268+
self.add(number_plane)
2269+
self.add(number_plane_scaled_y)
22512270
"""
22522271

22532272
def __init__(

0 commit comments

Comments
 (0)