数字平面

限定名称: manim.mobject.graphing.coordinate\_systems.NumberPlane

class NumberPlane(x_range=(-7.111111111111111, 7.111111111111111, 1), y_range=(-4.0, 4.0, 1), x_length=None, y_length=None, background_line_style=None, faded_line_style=None, faded_line_ratio=1, make_smooth_after_applying_functions=True, **kwargs)[source]

基础:Axes

创建一个带有背景线的笛卡尔平面。

Parameters:
  • x_range (Sequence[float] | None) – 平面在水平方向上的[x_min, x_max, x_step]值。

  • y_range (Sequence[float] | None) – 平面在垂直方向上的[y_min, y_max, y_step]值。

  • x_length (float | None) – 平面的宽度。

  • y_length (float | None) – 平面的高度。

  • background_line_style (dict[str, Any] | None) – 影响平面背景线构造的参数。

  • faded_line_style (dict[str, Any] | None) – 类似于 background_line_style,影响场景背景线的构建。

  • faded_line_ratio (int) – 确定背景线内的框的数量:2 = 4个框,3 = 9个框。

  • make_smooth_after_applying_functions (bool) – 目前不可用。

  • kwargs (dict[str, Any]) – 传递给Axes的额外参数。

注意

如果未定义x_lengthy_length,则会自动计算它们,使得每个轴上的一个单位为一个Manim单位长度。

示例

示例:NumberPlaneExample

../_images/NumberPlaneExample-1.png
from manim import *

class NumberPlaneExample(Scene):
    def construct(self):
        number_plane = NumberPlane(
            background_line_style={
                "stroke_color": TEAL,
                "stroke_width": 4,
                "stroke_opacity": 0.6
            }
        )
        self.add(number_plane)
class NumberPlaneExample(Scene):
    def construct(self):
        number_plane = NumberPlane(
            background_line_style={
                "stroke_color": TEAL,
                "stroke_width": 4,
                "stroke_opacity": 0.6
            }
        )
        self.add(number_plane)

示例:NumberPlaneScaled

../_images/NumberPlaneScaled-1.png
from manim import *

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)
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)

方法

get_vector

prepare_for_nonlinear_transform

属性

animate

用于动画化self的任何方法的应用。

animation_overrides

color

depth

mobject的深度。

fill_color

如果有多种颜色(用于渐变),则返回第一个颜色

height

mobject的高度。

n_points_per_curve

sheen_factor

stroke_color

width

mobject的宽度。

_get_lines()[source]
Generate all the lines, faded and not faded.

生成两组线:一组平行于X轴,另一组平行于Y轴。

Returns:

第一组(即非淡化的线条)和第二组(即淡化的线条)的线条,分别。

Return type:

元组[VGroup, VGroup]

_get_lines_parallel_to_axis(axis_parallel_to, axis_perpendicular_to, freq, ratio_faded_lines)[来源]

生成一组与轴平行的线。

Parameters:
  • axis_parallel_to (数字线) – 线条将与之平行的轴。

  • axis_perpendicular_to (数字线) – 线条将与之垂直的轴。

  • ratio_faded_lines (int) – 渐隐线之间的空间与非渐隐线之间的空间的比率。

  • freq (float) – 非衰减线的频率(每图形单位的非衰减线数量)。

Returns:

第一组(即与axis_parallel_to平行的非淡色线)和第二组

(即与axis_parallel_to平行的淡色线)线,分别。

Return type:

元组[VGroup, VGroup]

_init_background_lines()[source]

将初始化NumberPlanes的所有线条(无论是否褪色)

Return type:

_original__init__(x_range=(-7.111111111111111, 7.111111111111111, 1), y_range=(-4.0, 4.0, 1), x_length=None, y_length=None, background_line_style=None, faded_line_style=None, faded_line_ratio=1, make_smooth_after_applying_functions=True, **kwargs)

初始化自身。有关准确的签名,请参阅 help(type(self))。

Parameters:
  • x_range (序列[浮点数] | )

  • y_range (序列[浮点数] | )

  • x_length (浮点数 | )

  • y_length (float | None)

  • background_line_style (dict[str, Any] | None)

  • faded_line_style (dict[str, Any] | None)

  • faded_line_ratio (int)

  • make_smooth_after_applying_functions (bool)

  • kwargs (dict[str, Any])