Repository: ManimCommunity/manim
File: manim/mobject/graphing/coordinate_systems.py (Python)

Code before:
        .. manim:: GetLinesToPointExample
            :save_last_frame:

            class GetLinesToPointExample(Scene):
                def construct(self):
                    ax = Axes()
                    circ = Circle(radius=0.5).move_to([-4, -1.5, 0])

                    lines_1 = ax.get_lines_to_point(circ.get_right(), color=GREEN_B)
                    lines_2 = ax.get_lines_to_point(circ.get_corner(DL), color=BLUE_B)
                    self.add(ax, lines_1, lines_2, circ)
        """

        return VGroup(
            self.get_horizontal_line(point, **kwargs),
            self.get_vertical_line(point, **kwargs),
        )

    # graphing

    def plot(
        self,
        function: Callable[[float], float],
        x_range: Sequence[float] | None = None,
        use_vectorized: bool = False,
        colorscale: Union[Iterable[Color], Color] | None = None,
        colorscale_axis: int = 1,
        **kwargs,
    ):
        """Generates a curve based on a function.

        Parameters
        ----------
        function
            The function used to construct the :class:`~.ParametricFunction`.
        x_range
            The range of the curve along the axes. ``x_range = [x_min, x_max, x_step]``.
        use_vectorized
            Whether to pass in the generated t value array to the function. Only use this if your function supports it.
            Output should be a numpy array of shape ``[y_0, y_1, ...]``
        colorscale
            Colors of the function. Optional parameter used when coloring a function by values. Passing a list of colors
            and a colorscale_axes will color the function by y-value. Passing a list of tuples in the form ``(color, pivot)``
            allows user-defined pivots where the color transitions.
        colorscale_axis
            Defines the axis on which the colorscale is applied (0 = x, 1 = y), default is y-axis (1).
        kwargs
            Additional parameters to be passed to :class:`~.ParametricFunction`.

        Returns
        -------

Review comment (suggestion):
Passing a single color, which appears to be allowed based on this type hint, yields
```
ValueError: invalid literal for int() with base 16: ''
```

Also, the second option (passing an interable containing tuples of the form `(color, pivot)` is not captured by this type hint, this should be fixed.


Code after:
        --------
        .. manim:: GetHorizontalLineExample
            :save_last_frame:

            class GetHorizontalLineExample(Scene):
                def construct(self):
                    ax = Axes().add_coordinates()
                    point = ax @ (-4, 1.5)

                    dot = Dot(point)
                    line = ax.get_horizontal_line(point, line_func=Line)

                    self.add(ax, line, dot)
        """

        return self.get_line_from_axis_to_point(1, point, **kwargs)

    def get_lines_to_point(self, point: Sequence[float], **kwargs) -> VGroup:
        """Generate both horizontal and vertical lines from the axis to a point.

        Parameters
        ----------
        point
            A point on the scene.
        kwargs
            Additional parameters to be passed to :meth:`get_line_from_axis_to_point`

        Returns
        -------
        :class:`~.VGroup`
            A :class:`~.VGroup` of the horizontal and vertical lines.


        .. seealso::
            :meth:`~.CoordinateSystem.get_vertical_line`
            :meth:`~.CoordinateSystem.get_horizontal_line`

        Examples
        --------
        .. manim:: GetLinesToPointExample
            :save_last_frame:

            class GetLinesToPointExample(Scene):
                def construct(self):
                    ax = Axes()
                    circ = Circle(radius=0.5).move_to([-4, -1.5, 0])

                    lines_1 = ax.get_lines_to_point(circ.get_right(), color=GREEN_B)
                    lines_2 = ax.get_lines_to_point(circ.get_corner(DL), color=BLUE_B)
                    self.add(ax, lines_1, lines_2, circ)
        """