ThreeDAxes¶
Qualified name: manim.mobject.graphing.coordinate\_systems.ThreeDAxes
- class ThreeDAxes(x_range=(-6, 6, 1), y_range=(-5, 5, 1), z_range=(-4, 4, 1), x_length=10.5, y_length=10.5, z_length=6.5, z_axis_config=None, z_normal=array([0., -1., 0.]), num_axis_pieces=20, light_source=array([-7., -9., 10.]), depth=None, gloss=0.5, **kwargs)[source]¶
Bases:
AxesA 3-dimensional set of axes.
- Parameters:
x_range (Sequence[float] | None) – The
[x_min, x_max, x_step]values of the x-axis.y_range (Sequence[float] | None) – The
[y_min, y_max, y_step]values of the y-axis.z_range (Sequence[float] | None) – The
[z_min, z_max, z_step]values of the z-axis.x_length (float | None) – The length of the x-axis.
y_length (float | None) – The length of the y-axis.
z_length (float | None) – The length of the z-axis.
z_axis_config (dict[str, Any]) – Arguments to be passed to
NumberLinethat influence the z-axis.z_normal (Vector3DLike) – The direction of the normal.
num_axis_pieces (int) – The number of pieces used to construct the axes.
light_source (Point3DLike) – The direction of the light source.
depth (Any) – Currently non-functional.
gloss (float) – Currently non-functional.
kwargs (dict[str, Any]) – Additional arguments to be passed to
Axes.
Methods
Defines labels for the x_axis and y_axis of the graph.
Generate a y-axis label.
Generate a z-axis label.
Attributes
alwaysCall a method on a mobject every frame.
animateUsed to animate the application of any method of
self.animation_overridescolordepthThe depth of the mobject.
fill_colorIf there are multiple colors (for gradient) this returns the first one
heightThe height of the mobject.
n_points_per_curvesheen_factorstroke_colorwidthThe width of the mobject.
- _original__init__(x_range=(-6, 6, 1), y_range=(-5, 5, 1), z_range=(-4, 4, 1), x_length=10.5, y_length=10.5, z_length=6.5, z_axis_config=None, z_normal=array([0., -1., 0.]), num_axis_pieces=20, light_source=array([-7., -9., 10.]), depth=None, gloss=0.5, **kwargs)¶
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
x_range (Sequence[float] | None)
y_range (Sequence[float] | None)
z_range (Sequence[float] | None)
x_length (float | None)
y_length (float | None)
z_length (float | None)
z_axis_config (dict[str, Any] | None)
z_normal (Vector3DLike)
num_axis_pieces (int)
light_source (Point3DLike)
depth (Any)
gloss (float)
kwargs (dict[str, Any])
- get_axis_labels(x_label='x', y_label='y', z_label='z')[source]¶
Defines labels for the x_axis and y_axis of the graph.
For increased control over the position of the labels, use
get_x_axis_label(),get_y_axis_label(), andget_z_axis_label().- Parameters:
x_label (float | str | VMobject) – The label for the x_axis. Defaults to
MathTexforstrandfloatinputs.y_label (float | str | VMobject) – The label for the y_axis. Defaults to
MathTexforstrandfloatinputs.z_label (float | str | VMobject) – The label for the z_axis. Defaults to
MathTexforstrandfloatinputs.
- Returns:
A
VGroupof the labels for the x_axis, y_axis, and z_axis.- Return type:
Examples
Example: GetAxisLabelsExample ¶
from manim import * class GetAxisLabelsExample(ThreeDScene): def construct(self): self.set_camera_orientation(phi=2*PI/5, theta=PI/5) axes = ThreeDAxes() labels = axes.get_axis_labels( Text("x-axis").scale(0.7), Text("y-axis").scale(0.45), Text("z-axis").scale(0.45) ) self.add(axes, labels)
class GetAxisLabelsExample(ThreeDScene): def construct(self): self.set_camera_orientation(phi=2*PI/5, theta=PI/5) axes = ThreeDAxes() labels = axes.get_axis_labels( Text("x-axis").scale(0.7), Text("y-axis").scale(0.45), Text("z-axis").scale(0.45) ) self.add(axes, labels)
- get_y_axis_label(label, edge=array([1., 1., 0.]), direction=array([1., 1., 0.]), buff=0.1, rotation=1.5707963267948966, rotation_axis=array([0., 0., 1.]), **kwargs)[source]¶
Generate a y-axis label.
- Parameters:
label (float | str | VMobject) – The label. Defaults to
MathTexforstrandfloatinputs.edge (Vector3DLike) – The edge of the y-axis to which the label will be added, by default
UR.direction (Vector3DLike) – Allows for further positioning of the label from an edge, by default
UR.buff (float) – The distance of the label from the line, by default
SMALL_BUFF.rotation (float) – The angle at which to rotate the label, by default
PI/2.rotation_axis (Vector3DLike) – The axis about which to rotate the label, by default
OUT.kwargs (dict[str, Any])
- Returns:
The positioned label.
- Return type:
Examples
Example: GetYAxisLabelExample ¶
from manim import * class GetYAxisLabelExample(ThreeDScene): def construct(self): ax = ThreeDAxes() lab = ax.get_y_axis_label(Tex("$y$-label")) self.set_camera_orientation(phi=2*PI/5, theta=PI/5) self.add(ax, lab)
class GetYAxisLabelExample(ThreeDScene): def construct(self): ax = ThreeDAxes() lab = ax.get_y_axis_label(Tex("$y$-label")) self.set_camera_orientation(phi=2*PI/5, theta=PI/5) self.add(ax, lab)
- get_z_axis_label(label, edge=array([0., 0., 1.]), direction=array([1., 0., 0.]), buff=0.1, rotation=1.5707963267948966, rotation_axis=array([1., 0., 0.]), **kwargs)[source]¶
Generate a z-axis label.
- Parameters:
label (float | str | VMobject) – The label. Defaults to
MathTexforstrandfloatinputs.edge (Vector3DLike) – The edge of the z-axis to which the label will be added, by default
OUT.direction (Vector3DLike) – Allows for further positioning of the label from an edge, by default
RIGHT.buff (float) – The distance of the label from the line, by default
SMALL_BUFF.rotation (float) – The angle at which to rotate the label, by default
PI/2.rotation_axis (Vector3DLike) – The axis about which to rotate the label, by default
RIGHT.kwargs (Any)
- Returns:
The positioned label.
- Return type:
Examples
Example: GetZAxisLabelExample ¶
from manim import * class GetZAxisLabelExample(ThreeDScene): def construct(self): ax = ThreeDAxes() lab = ax.get_z_axis_label(Tex("$z$-label")) self.set_camera_orientation(phi=2*PI/5, theta=PI/5) self.add(ax, lab)
class GetZAxisLabelExample(ThreeDScene): def construct(self): ax = ThreeDAxes() lab = ax.get_z_axis_label(Tex("$z$-label")) self.set_camera_orientation(phi=2*PI/5, theta=PI/5) self.add(ax, lab)