数平面¶
限定名称: 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
创建一个带有背景线的笛卡尔平面。
- 参数:
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_length
或y_length
,它们将自动计算,使每个轴上的一个单位等于一个Manim单位长度。示例
示例:NumberPlaneExample ¶
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 ¶
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 (动画覆盖)
颜色
depth (深度)
mobject 的深度。
fill_color (填充颜色)
如果存在多种颜色(用于渐变),则返回第一种颜色
height (高度)
mobject 的高度。
n_points_per_curve (每条曲线的点数)
sheen_factor (光泽因子)
stroke_color (描边颜色)
width (宽度)
mobject 的宽度。
- _get_lines_parallel_to_axis(axis_parallel_to, axis_perpendicular_to, freq, ratio_faded_lines)[source]¶
生成一组平行于轴的线条。
- 参数:
axis_parallel_to (NumberLine) – 线条将平行于的轴。
axis_perpendicular_to (NumberLine) – 线条将垂直于的轴。
ratio_faded_lines (int) – 淡化线条间距与非淡化线条间距之间的比率。
freq (float) – 非淡化线条的频率(每图单位的非淡化线条数量)。
- 返回:
- 第一组线条(即平行于axis_parallel_to的非淡化线条)和第二组
(即平行于axis_parallel_to的淡化线条)线条集合。
- 返回类型:
- _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))。
- 参数:
x_range (Sequence[float] | None)
y_range (Sequence[float] | None)
x_length (float | None)
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 (布尔值)
kwargs (dict[str, Any])