ComplexPlane¶
Qualified name: manim.mobject.graphing.coordinate\_systems.ComplexPlane
- class ComplexPlane(**kwargs)[source]¶
Bases:
NumberPlaneA
NumberPlanespecialized 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
DecimalNumbermobjects 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
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.
- 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)
- 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
DecimalNumbermobjects 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
VGroupcontaining 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 (Point3DLike)
- Return type:
complex
- point_to_number(point)[source]¶
Accepts a point and returns a complex number equivalent to that point on the plane.
- Parameters:
point (Point3DLike) – The point in manim’s coordinate-system
- Returns:
A complex number consisting of real and imaginary components.
- Return type:
complex