from manim import *

class PlotTwoGraphsAtOnce(Scene):
    def construct(self):
        axes = Axes(
            x_range=[-10, 10.3, 1],
            y_range=[-1.5, 1.5, 1],
            x_length=10,
            axis_config={"color": GREEN},
            x_axis_config={
                "numbers_to_include": np.arange(-10, 10.01, 2),
                "numbers_with_elongated_ticks": np.arange(-10, 10.01, 2),
            },
            tips=False,
        )
        axes.scale(0.3)
        axes.shift(3*LEFT)
        axes_labels = axes.get_axis_labels()
        sin_graph = axes.get_graph(lambda x: np.sin(x), color=BLUE)
        cos_graph = axes.get_graph(lambda x: np.cos(x), color=RED)

        sin_label = axes.get_graph_label(
            sin_graph, "\\sin(x)", x_val=-10, direction=UP / 2
        )
        cos_label = axes.get_graph_label(cos_graph, label="\\cos(x)")

        vert_line = axes.get_vertical_line(
            axes.i2gp(TAU, cos_graph), color=YELLOW, line_func=Line
        )
        line_label = axes.get_graph_label(
            cos_graph, "x=2\pi", x_val=TAU, direction=UR, color=WHITE
        )

        plot = VGroup(axes, sin_graph, cos_graph, vert_line)
        labels = VGroup(axes_labels, sin_label, cos_label, line_label)
        graph_1 = VGroup(plot,labels)
        # self.add(plot, labels)
        ax = Axes(
            x_range=[0, 5],
            y_range=[0, 6],
            x_axis_config={"numbers_to_include": [2, 3]},
            tips=False,
        )
        ax.scale(0.3)

        ax.shift(3*RIGHT)

        labels_2 = ax.get_axis_labels()

        curve_1 = ax.get_graph(lambda x: 4 * x - x ** 2, x_range=[0, 4], color=BLUE_C)
        curve_2 = ax.get_graph(
            lambda x: 0.8 * x ** 2 - 3 * x + 4,
            x_range=[0, 4],
            color=GREEN_B,
        )

        line_1 = ax.get_vertical_line(ax.input_to_graph_point(2, curve_1), color=YELLOW)
        line_2 = ax.get_vertical_line(ax.i2gp(3, curve_1), color=YELLOW)

        area_1 = ax.get_area(curve_1, x_range=[0.3, 0.6], dx_scaling=40, color=BLUE)
        area_2 = ax.get_area(curve_2, [2, 3], bounded=curve_1, color=GREY, opacity=0.2)

        graph_2 = VGroup(ax, labels_2, curve_1, curve_2, line_1, line_2, area_1, area_2)
        # self.add(ax, labels_2, curve_1, curve_2, line_1, line_2, area_1, area_2)
        self.play(FadeIn(graph_1))
        self.wait(2)
        self.play(FadeIn(graph_2))

2df1c067d1b1f5fc0c85b6ba221846d238538b13
<mask token>

<mask token>


class PlotTwoGraphsAtOnce(Scene):
    <mask token>

<mask token>


class PlotTwoGraphsAtOnce(Scene):

    def construct(self):
        axes = Axes(x_range=[-10, 10.3, 1], y_range=[-1.5, 1.5, 1],
            x_length=10, axis_config={'color': GREEN}, x_axis_config={
            'numbers_to_include': np.arange(-10, 10.01, 2),
            'numbers_with_elongated_ticks': np.arange(-10, 10.01, 2)}, tips
            =False)
        axes.scale(0.3)
        axes.shift(3 * LEFT)
        axes_labels = axes.get_axis_labels()
        sin_graph = axes.get_graph(lambda x: np.sin(x), color=BLUE)
        cos_graph = axes.get_graph(lambda x: np.cos(x), color=RED)
        sin_label = axes.get_graph_label(sin_graph, '\\sin(x)', x_val=-10,
            direction=UP / 2)
        cos_label = axes.get_graph_label(cos_graph, label='\\cos(x)')
        vert_line = axes.get_vertical_line(axes.i2gp(TAU, cos_graph), color
            =YELLOW, line_func=Line)
        line_label = axes.get_graph_label(cos_graph, 'x=2\\pi', x_val=TAU,
            direction=UR, color=WHITE)
        plot = VGroup(axes, sin_graph, cos_graph, vert_line)
        labels = VGroup(axes_labels, sin_label, cos_label, line_label)
        graph_1 = VGroup(plot, labels)
        ax = Axes(x_range=[0, 5], y_range=[0, 6], x_axis_config={
            'numbers_to_include': [2, 3]}, tips=False)
        ax.scale(0.3)
        ax.shift(3 * RIGHT)
        labels_2 = ax.get_axis_labels()
        curve_1 = ax.get_graph(lambda x: 4 * x - x ** 2, x_range=[0, 4],
            color=BLUE_C)
        curve_2 = ax.get_graph(lambda x: 0.8 * x ** 2 - 3 * x + 4, x_range=
            [0, 4], color=GREEN_B)
        line_1 = ax.get_vertical_line(ax.input_to_graph_point(2, curve_1),
            color=YELLOW)
        line_2 = ax.get_vertical_line(ax.i2gp(3, curve_1), color=YELLOW)
        area_1 = ax.get_area(curve_1, x_range=[0.3, 0.6], dx_scaling=40,
            color=BLUE)
        area_2 = ax.get_area(curve_2, [2, 3], bounded=curve_1, color=GREY,
            opacity=0.2)
        graph_2 = VGroup(ax, labels_2, curve_1, curve_2, line_1, line_2,
            area_1, area_2)
        self.play(FadeIn(graph_1))
        self.wait(2)
        self.play(FadeIn(graph_2))

from manim import *


class PlotTwoGraphsAtOnce(Scene):

    def construct(self):
        axes = Axes(x_range=[-10, 10.3, 1], y_range=[-1.5, 1.5, 1],
            x_length=10, axis_config={'color': GREEN}, x_axis_config={
            'numbers_to_include': np.arange(-10, 10.01, 2),
            'numbers_with_elongated_ticks': np.arange(-10, 10.01, 2)}, tips
            =False)
        axes.scale(0.3)
        axes.shift(3 * LEFT)
        axes_labels = axes.get_axis_labels()
        sin_graph = axes.get_graph(lambda x: np.sin(x), color=BLUE)
        cos_graph = axes.get_graph(lambda x: np.cos(x), color=RED)
        sin_label = axes.get_graph_label(sin_graph, '\\sin(x)', x_val=-10,
            direction=UP / 2)
        cos_label = axes.get_graph_label(cos_graph, label='\\cos(x)')
        vert_line = axes.get_vertical_line(axes.i2gp(TAU, cos_graph), color
            =YELLOW, line_func=Line)
        line_label = axes.get_graph_label(cos_graph, 'x=2\\pi', x_val=TAU,
            direction=UR, color=WHITE)
        plot = VGroup(axes, sin_graph, cos_graph, vert_line)
        labels = VGroup(axes_labels, sin_label, cos_label, line_label)
        graph_1 = VGroup(plot, labels)
        ax = Axes(x_range=[0, 5], y_range=[0, 6], x_axis_config={
            'numbers_to_include': [2, 3]}, tips=False)
        ax.scale(0.3)
        ax.shift(3 * RIGHT)
        labels_2 = ax.get_axis_labels()
        curve_1 = ax.get_graph(lambda x: 4 * x - x ** 2, x_range=[0, 4],
            color=BLUE_C)
        curve_2 = ax.get_graph(lambda x: 0.8 * x ** 2 - 3 * x + 4, x_range=
            [0, 4], color=GREEN_B)
        line_1 = ax.get_vertical_line(ax.input_to_graph_point(2, curve_1),
            color=YELLOW)
        line_2 = ax.get_vertical_line(ax.i2gp(3, curve_1), color=YELLOW)
        area_1 = ax.get_area(curve_1, x_range=[0.3, 0.6], dx_scaling=40,
            color=BLUE)
        area_2 = ax.get_area(curve_2, [2, 3], bounded=curve_1, color=GREY,
            opacity=0.2)
        graph_2 = VGroup(ax, labels_2, curve_1, curve_2, line_1, line_2,
            area_1, area_2)
        self.play(FadeIn(graph_1))
        self.wait(2)
        self.play(FadeIn(graph_2))

from manim import *

class PlotTwoGraphsAtOnce(Scene):
    def construct(self):
        axes = Axes(
            x_range=[-10, 10.3, 1],
            y_range=[-1.5, 1.5, 1],
            x_length=10,
            axis_config={"color": GREEN},
            x_axis_config={
                "numbers_to_include": np.arange(-10, 10.01, 2),
                "numbers_with_elongated_ticks": np.arange(-10, 10.01, 2),
            },
            tips=False,
        )
        axes.scale(0.3)
        axes.shift(3*LEFT)
        axes_labels = axes.get_axis_labels()
        sin_graph = axes.get_graph(lambda x: np.sin(x), color=BLUE)
        cos_graph = axes.get_graph(lambda x: np.cos(x), color=RED)

        sin_label = axes.get_graph_label(
            sin_graph, "\\sin(x)", x_val=-10, direction=UP / 2
        )
        cos_label = axes.get_graph_label(cos_graph, label="\\cos(x)")

        vert_line = axes.get_vertical_line(
            axes.i2gp(TAU, cos_graph), color=YELLOW, line_func=Line
        )
        line_label = axes.get_graph_label(
            cos_graph, "x=2\pi", x_val=TAU, direction=UR, color=WHITE
        )

        plot = VGroup(axes, sin_graph, cos_graph, vert_line)
        labels = VGroup(axes_labels, sin_label, cos_label, line_label)
        graph_1 = VGroup(plot,labels)
        # self.add(plot, labels)
        ax = Axes(
            x_range=[0, 5],
            y_range=[0, 6],
            x_axis_config={"numbers_to_include": [2, 3]},
            tips=False,
        )
        ax.scale(0.3)

        ax.shift(3*RIGHT)

        labels_2 = ax.get_axis_labels()

        curve_1 = ax.get_graph(lambda x: 4 * x - x ** 2, x_range=[0, 4], color=BLUE_C)
        curve_2 = ax.get_graph(
            lambda x: 0.8 * x ** 2 - 3 * x + 4,
            x_range=[0, 4],
            color=GREEN_B,
        )

        line_1 = ax.get_vertical_line(ax.input_to_graph_point(2, curve_1), color=YELLOW)
        line_2 = ax.get_vertical_line(ax.i2gp(3, curve_1), color=YELLOW)

        area_1 = ax.get_area(curve_1, x_range=[0.3, 0.6], dx_scaling=40, color=BLUE)
        area_2 = ax.get_area(curve_2, [2, 3], bounded=curve_1, color=GREY, opacity=0.2)

        graph_2 = VGroup(ax, labels_2, curve_1, curve_2, line_1, line_2, area_1, area_2)
        # self.add(ax, labels_2, curve_1, curve_2, line_1, line_2, area_1, area_2)
        self.play(FadeIn(graph_1))
        self.wait(2)
        self.play(FadeIn(graph_2))
