ComplexPlane#
Qualified name: manim.mobject.graphing.coordinate\_systems.ComplexPlane
- class ComplexPlane(**kwargs)[source]#
Bases:
NumberPlane
A
NumberPlane
specialized for use with complex numbers.Examples
Example: ComplexPlaneExample ¶
from manim import * class ComplexPlaneExample(Scene): def construct(self): plane = ComplexPlane().add_coordinates() self.add(plane) d1 = Dot(plane.n2p(2 + 1j), color=YELLOW) d2 = Dot(plane.n2p(-3 - 2j), color=YELLOW) label1 = MathTex("2+i").next_to(d1, UR, 0.1) label2 = MathTex("-3-2i").next_to(d2, UR, 0.1) self.add( d1, label1, d2, label2, )
class ComplexPlaneExample(Scene): def construct(self): plane = ComplexPlane().add_coordinates() self.add(plane) d1 = Dot(plane.n2p(2 + 1j), color=YELLOW) d2 = Dot(plane.n2p(-3 - 2j), color=YELLOW) label1 = MathTex("2+i").next_to(d1, UR, 0.1) label2 = MathTex("-3-2i").next_to(d2, UR, 0.1) self.add( d1, label1, d2, label2, )
Methods
Adds the labels produced from
get_coordinate_labels()
to the plane.Generates the
DecimalNumber
mobjects for the coordinates of the plane.Abbreviation for
number_to_point()
.Accepts a float/complex number and returns the equivalent point on the plane.
Abbreviation for
point_to_number()
.Accepts a point and returns a complex number equivalent to that point on the plane.
Attributes
animate
Used to animate the application of any method of
self
.animation_overrides
color
depth
The depth of the mobject.
fill_color
If there are multiple colors (for gradient) this returns the first one
height
The height of the mobject.
n_points_per_curve
sheen_factor
stroke_color
width
The width of the mobject.
- Parameters:
kwargs (Any) –
- _get_default_coordinate_values()[source]#
Generate a list containing the numerical values of the plane’s labels.
- Returns:
A list of floats representing the x-axis and complex numbers representing the y-axis.
- Return type:
List[float | complex]
- _original__init__(**kwargs)#
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
kwargs (Any) –
- Return type:
None
- add_coordinates(*numbers, **kwargs)[source]#
Adds the labels produced from
get_coordinate_labels()
to the plane.- Parameters:
numbers (Iterable[float | complex]) – An iterable of floats/complex numbers. Floats are positioned along the x-axis, complex numbers along the y-axis.
kwargs (Any) – Additional arguments to be passed to
get_number_mobject()
, i.e.DecimalNumber
.
- Return type:
Self
- get_coordinate_labels(*numbers, **kwargs)[source]#
Generates the
DecimalNumber
mobjects for the coordinates of the plane.- Parameters:
numbers (Iterable[float | complex]) – An iterable of floats/complex numbers. Floats are positioned along the x-axis, complex numbers along the y-axis.
kwargs (Any) – Additional arguments to be passed to
get_number_mobject()
, i.e.DecimalNumber
.
- Returns:
A
VGroup
containing the positioned label mobjects.- Return type:
- n2p(number)[source]#
Abbreviation for
number_to_point()
.- Parameters:
number (float | complex) –
- Return type:
ndarray
- number_to_point(number)[source]#
Accepts a float/complex number and returns the equivalent point on the plane.
- Parameters:
number (float | complex) – The number. Can be a float or a complex number.
- Returns:
The point on the plane.
- Return type:
np.ndarray
- p2n(point)[source]#
Abbreviation for
point_to_number()
.- Parameters:
point (Point3D) –
- Return type:
complex