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

../_images/ComplexPlaneExample-1.png
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,
        )

References: Dot MathTex

Methods

add_coordinates

Adds the labels produced from get_coordinate_labels() to the plane.

get_coordinate_labels

Generates the DecimalNumber mobjects for the coordinates of the plane.

n2p

Abbreviation for number_to_point().

number_to_point

Accepts a float/complex number and returns the equivalent point on the plane.

p2n

Abbreviation for point_to_number().

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.

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 – Additional arguments to be passed to get_number_mobject(), i.e. DecimalNumber.

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 – Additional arguments to be passed to get_number_mobject(), i.e. DecimalNumber.

Returns

A VGroup containing the positioned label mobjects.

Return type

VGroup

n2p(number)[source]#

Abbreviation for number_to_point().

Parameters

number (float | complex) –

Return type

np.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 (Sequence[float]) –

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 (Sequence[float]) – The point in manim’s coordinate-system

Returns

A complex number consisting of real and imaginary components.

Return type

complex