def create_plot(
        value: pd.DataFrame,
        x: str,
        y: str,
        color: str | None = None,
        stroke_dash: str | None = None,
        overlay_point: bool | None = None,
        title: str | None = None,
        tooltip: list[str] | str | None = None,
        x_title: str | None = None,
        y_title: str | None = None,
        x_label_angle: float | None = None,
        y_label_angle: float | None = None,
        color_legend_title: str | None = None,
        stroke_dash_legend_title: str | None = None,
        color_legend_position: Literal[
            "left",
            "right",
            "top",
            "bottom",
            "top-left",
            "top-right",
            "bottom-left",
            "bottom-right",
            "none",
        ]
        | None = None,
        stroke_dash_legend_position: Literal[
            "left",
            "right",
            "top",
            "bottom",
            "top-left",
            "top-right",
            "bottom-left",
            "bottom-right",
            "none",
        ]
        | None = None,
        height: int | None = None,
        width: int | None = None,
        x_lim: list[int] | None = None,
        y_lim: list[int] | None = None,
    ):
        """Helper for creating the scatter plot."""
        import altair as alt

        encodings = {
            "x": alt.X(
                x,
                title=x_title or x,
                scale=AltairPlot.create_scale(x_lim),
                axis=alt.Axis(labelAngle=x_label_angle)
                if x_label_angle is not None
                else alt.Axis(),
            ),
            "y": alt.Y(
                y,
                title=y_title or y,
                scale=AltairPlot.create_scale(y_lim),
                axis=alt.Axis(labelAngle=y_label_angle)
                if y_label_angle is not None
                else alt.Axis(),
            ),
        }
        properties = {}
        if title:
            properties["title"] = title
        if height:
            properties["height"] = height
        if width:
            properties["width"] = width

        if color:
            color_legend_position = color_legend_position or "bottom"
            domain = value[color].unique().tolist()
            range_ = list(range(len(domain)))
            encodings["color"] = {
                "field": color,
                "type": "nominal",
                "scale": {"domain": domain, "range": range_},
                "legend": AltairPlot.create_legend(
                    position=color_legend_position, title=color_legend_title
                ),
            }

        if stroke_dash:
            stroke_dash_encoding = {
                "field": stroke_dash,
                "legend": AltairPlot.create_legend(
                    position=stroke_dash_legend_position or "bottom",
                    title=stroke_dash_legend_title,
                ),
            }
        else:
            stroke_dash_encoding = alt.value(alt.Undefined)

        if tooltip:
            encodings["tooltip"] = tooltip

        chart = alt.Chart(value).encode(**encodings)

        points = chart.mark_point(clip=True).encode(
            opacity=alt.value(alt.Undefined) if overlay_point else alt.value(0),
        )
        lines = chart.mark_line(clip=True).encode(strokeDash=stroke_dash_encoding)

        highlight = alt.selection_point(
            on="mouseover",
            fields=[c for c in [color, stroke_dash] if c],
            nearest=True,
            clear="mouseout",
            empty=False,
        )
        points = points.add_params(highlight)
        lines = lines.encode(
            size=alt.condition(highlight, alt.value(4), alt.value(2)),
        )
        if not overlay_point:
            highlight_pts = alt.selection_point(
                on="mouseover",
                nearest=True,
                clear="mouseout",
                empty=False,
            )
            points = points.add_params(highlight_pts)

            points = points.encode(
                opacity=alt.condition(highlight_pts, alt.value(1), alt.value(0)),
                size=alt.condition(highlight_pts, alt.value(100), alt.value(0)),
            )

        chart = (lines + points).properties(background="transparent", **properties)

        selection = alt.selection_interval(
            encodings=["x"],
            mark=alt.BrushConfig(fill="gray", fillOpacity=0.3, stroke="none"),
            name="brush",
        )
        chart = chart.add_params(selection)

        return chart
Helper for creating the scatter plot.
gradio/components/line_plot.py