如何为使用 manim python 库生成的图表添加 y=0 处的刻度标签?

问题描述 投票:0回答:1

使用 manim python 库生成图形时,如何在 y=0 处添加刻度标签?我尝试使用

y_axis_config
参数添加它,但没有得到所需的结果(参见附图)。非常感谢任何帮助!!

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

我尝试使用

更改
Numberline

类的配置参数
ax_exp1.get_y_axis_config()['numbers_to_exclude'] = []
ax_exp1.get_y_axis_config()['exclude_origin_tick'] = False

我也尝试过:

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

但是它们都不起作用。

python plot graphing manim algorithm-animation
1个回答
0
投票

这对我有用:

   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})
© www.soinside.com 2019 - 2024. All rights reserved.