0

我是 manim 的新手,我很享受。我想在 NumberPlane 上绘制图表,我使用了以下代码

`类PlotFunctions(GraphScene):

CONFIG = {
    "x_min" : -10,
    "x_max" : 10.3,
    "y_min" : -1.5,
    "y_max" : 1.5,
    "graph_origin" : ORIGIN ,
    "function_color" : RED ,
    "axes_color" : GREEN,
    "x_labeled_nums" :range(-10,12,2),
}
def construct(self):
    self.setup_axes(animate=True)
    plane=NumberPlane()
    txt=TextMobject("Test")
    self.add(plane)
    self.play(Write(txt))`

NumberPlane 和 GraphScene 上的坐标似乎不匹配。

坐标错位

我怎样才能解决这个问题?提前致谢 !

4

1 回答 1

0

当您想使用 NumberPlane 时,最好扩展 Scene 类。

代码将是,

class PlotFunctions(GraphScene):    
def construct(self):        
    plane=NumberPlane()
    txt = TextMobject("One")
    self.add(plane)
    self.play(Write(txt))
    self.wait()

也可以在 NumberPlane 上绘制图形,GraphScene 扩展。你可以在这里找到一些示例代码。

于 2020-07-13T06:49:31.387 回答