数字平面¶
限定名称: 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_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_vectorprepare_for_nonlinear_transform属性
animate用于动画化
self的任何方法的应用。animation_overridescolordepthmobject的深度。
fill_color如果有多种颜色(用于渐变),则返回第一个颜色
heightmobject的高度。
n_points_per_curvesheen_factorstroke_colorwidthmobject的宽度。
- _get_lines_parallel_to_axis(axis_parallel_to, axis_perpendicular_to, freq, ratio_faded_lines)[来源]¶
生成一组与轴平行的线。
- _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])