如何在Manim中的数字线上添加我自己的数字?
我想在Manim中的数字行中添加自己的数字,因为现在我所能做的就是给出一系列数字,但我想添加诸如PI,Squareroot,Migy数字之类的数字,例如我自己的数字列表而不是生成的数字列表通过函数范围。正确的方法是什么?请帮忙。
这是我的代码:
class NumbersClass(Scene):
def construct(self):
num_line = NumberLine(x_range=[-3, 3, 0.5],
unit_size=2,
color=ORANGE,
include_numbers=True,
decimal_number_config={
"num_decimal_places": 1},
)
self.play(DrawBorderThenFill(num_line), run_time=2)
self.wait(duration=1)
I want to add my own numbers on Number Line in Manim, for now all i can do is just give a range of numbers but i want to add numbers like PI, SquareRoots, Imaginary Numbers, like a list of my own numbers not a generated range by a function. what is the right way to do it? please help.
This is my code:
class NumbersClass(Scene):
def construct(self):
num_line = NumberLine(x_range=[-3, 3, 0.5],
unit_size=2,
color=ORANGE,
include_numbers=True,
decimal_number_config={
"num_decimal_places": 1},
)
self.play(DrawBorderThenFill(num_line), run_time=2)
self.wait(duration=1)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道您的问题正在处理输入。因此,您可以将它们作为字符串输入并将其转换为特定类型,例如:
在这里,终端上输入/输出的一个例子:
我希望这会有所帮助!
PS:我没有使用任何正格来评估空间(例如,加上空间的空间会导致例外),也没有试图涵盖常见的加薪异常。
I understood that your issue is working on the inputs. So you could input them as strings and convert them to the specific type, like this:
And here one example of input/output on the terminal:
I hope that helps!
p.s.: I didn't use any regex to evaluate spaces (e.g. '2+ 5j' with space after plus would lead to an exception), neither tried to cover common raise exceptions.