How can I set the range for a graph in manim? #1402
-
I have tried two different approaches:
and
Both of them give me domain error. My axes looks like this:
How can I show a plot from -2 to 2 while the graph goes from -5 to 5? The graph also does not seem very smooth. Can anyone please help? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
I can try to use |
Beta Was this translation helpful? Give feedback.
-
@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)
It can be made smooth by decreasing the sample frequency (i.e |
Beta Was this translation helpful? Give feedback.
@baljeetrathi This code works for me though?
It can be made smooth by decreasing the sample frequency (i.e
x_step
, which is 0.001 here)