Skip to content

How can I set the range for a graph in manim? #1402

Answered by ghost
baljeetrathi asked this question in Q&A
Discussion options

You must be logged in to vote

@baljeetrathi This code works for me though?

class AxesGraph(Scene):
    def construct(self):
        axes = Axes([-5, 5], [-5, 5])
        graph = axes.get_graph(
            lambda x: math.sqrt(1 - (abs(x) - 1) ** 2),
            x_range=[-2, 2, 0.001]  # x_min, x_max, x_step
        )
        self.add(axes, graph)

The graph also does not seem very smooth

It can be made smooth by decreasing the sample frequency (i.e x_step, which is 0.001 here)

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
4 replies
@baljeetrathi
Comment options

@Just-Math
Comment options

@baljeetrathi
Comment options

@Just-Math
Comment options

Comment options

You must be logged in to vote
3 replies
@baljeetrathi
Comment options

@ghost
Comment options

@baljeetrathi
Comment options

Answer selected by TonyCrane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants