How do I add a tick label at y=0 for graphs generated using manim python library?

60 views Asked by At

How do I add a tick label at y=0 when generating graphs using manim python library? I tried adding it using the y_axis_config parameter, but I didn't get the desired result (see the attached image). Any help is highly appreciated!!

ax_exp1 = Axes(x_range=[0, 2.25, 0.3],
            y_range=[-0.2, 0.35, 0.1],
            x_length=13,
            y_length=5,
            axis_config={"include_numbers": True}).scale(0.7)
t_steps = 2100000
ax_exp1.next_to(img_1, RIGHT)
ax_exp1.get_x_axis().shift(1.3*DOWN)
ax_exp1.get_y_axis_config()['numbers_to_exclude'] = []
ax_exp1.get_y_axis_config()['exclude_origin_tick'] = False

enter image description here

I tried changing the config parameters of the Numberline class using

ax_exp1.get_y_axis_config()['numbers_to_exclude'] = []
ax_exp1.get_y_axis_config()['exclude_origin_tick'] = False

I also tried:

ticker_0 = MathTex(r"0").move_to(ax_exp1.c2p(0,0))
ax_exp1.add(ticker_0)
self.add(ax_exp1, graph, ticker_0)

But neither of them worked.

1

There are 1 answers

0
Toon Kuipers On

This works for me:

   grid=Axes(x_range=[0,1,0.1],
              y_range=[0,1,0.1],
              x_length=6,
              y_length=6,
              axis_config={"numbers_to_exclude": (),
                           "numbers_to_include": (0,0.5,1),
                           "include_tip": False})