In GraphScene, using setup_axes to setup the axes, How to FadeOut the axes to prepare the room for other animation?
After setup_axes, I try to change the graph_origin to move the axes, also failed.
Technically you can do it using the self.axes
object:
class Plot(GraphScene):
CONFIG = {
"y_max" : 50,
"y_min" : 0,
"x_max" : 7,
"x_min" : 0,
"y_tick_frequency" : 5,
"x_tick_frequency" : 0.5,
}
def construct(self):
self.setup_axes()
graph = self.get_graph(lambda x : x**2,
color = GREEN,
x_min = 0,
x_max = 7
)
self.play(
ShowCreation(graph),
run_time = 2
)
self.wait()
self.play(FadeOut(self.axes))
self.wait()
But, GraphScene was intended to be used once for each axes (you can create multiple graphs on the axes, but not change the axes), if you are going to be changing them then use Scene, here is an example:
class Plot2(Scene):
def construct(self):
c1 = FunctionGraph(lambda x: 2*np.exp(-2*(x-1)**2))
c2 = FunctionGraph(lambda x: x**2)
axes1=Axes(y_min=-3,y_max=3)
axes2=Axes(y_min=0,y_max=10)
self.play(ShowCreation(axes1),ShowCreation(c1))
self.wait()
self.play(
ReplacementTransform(axes1,axes2),
ReplacementTransform(c1,c2)
)
self.wait()
However, in case you want to make a very personalized graph, you will have to add more options to the axes, and the axes are created using NumberLine. This is not so easy to do but you can use the manimlib/scene/graph_scene.py example to guide you, the Axes code is in manimlib/mobject/coordinate_systems.py, the NumberLine code is in manimlib/mobject/number_line.py and the FunctionGraph code is in manimlib/mobject/functions.py to see more options.