LabeledLine

Qualified name: manim.mobject.geometry.labeled.LabeledLine

class LabeledLine(label, label_position=0.5, font_size=48, label_color=ManimColor('#FFFFFF'), label_frame=True, frame_fill_color=None, frame_fill_opacity=1, *args, **kwargs)[source]

Bases: Line

Constructs a line containing a label box somewhere along its length.

Parameters:
  • label (str | Tex | MathTex | Text) – Label that will be displayed on the line.

  • label_position (float | optional) – A ratio in the range [0-1] to indicate the position of the label with respect to the length of the line. Default value is 0.5.

  • font_size (float | optional) – Control font size for the label. This parameter is only used when label is of type str.

  • label_color (ParsableManimColor | optional) – The color of the label’s text. This parameter is only used when label is of type str.

  • label_frame (Bool | optional) – Add a SurroundingRectangle frame to the label box.

  • frame_fill_color (ParsableManimColor | optional) – Background color to fill the label box. If no value is provided, the background color of the canvas will be used.

  • frame_fill_opacity (float | optional) – Determine the opacity of the label box by passing a value in the range [0-1], where 0 indicates complete transparency and 1 means full opacity.

  • seealso:: (..) – LabeledArrow

Examples

Example: LabeledLineExample

../_images/LabeledLineExample-1.png
from manim import *

class LabeledLineExample(Scene):
    def construct(self):
        line = LabeledLine(
            label          = '0.5',
            label_position = 0.8,
            font_size      = 20,
            label_color    = WHITE,
            label_frame    = True,

            start=LEFT+DOWN,
            end=RIGHT+UP)

        line.set_length(line.get_length() * 2)
        self.add(line)
class LabeledLineExample(Scene):
    def construct(self):
        line = LabeledLine(
            label          = '0.5',
            label_position = 0.8,
            font_size      = 20,
            label_color    = WHITE,
            label_frame    = True,

            start=LEFT+DOWN,
            end=RIGHT+UP)

        line.set_length(line.get_length() * 2)
        self.add(line)

Methods

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.

_original__init__(label, label_position=0.5, font_size=48, label_color=ManimColor('#FFFFFF'), label_frame=True, frame_fill_color=None, frame_fill_opacity=1, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

Parameters:
Return type:

None