要使用 manim 绘制直角坐标系,可以使用 manim 库中的 Axes 类。\n\n以下是一个绘制直角坐标系的示例代码:\n\npython\nfrom manim import *\n\nclass CoordinateSystem(Scene):\n def construct(self):\n axes = Axes(\n x_range=(-5, 5, 1),\n y_range=(-5, 5, 1),\n x_length=10,\n y_length=10,\n axis_config={\n "color": WHITE,\n "stroke_width": 2,\n "include_numbers": True,\n "include_tip": False,\n },\n tips=False,\n )\n \n self.add(axes)\n self.wait()\n\n\n在这个示例中,我们创建了一个 CoordinateSystem 类,继承自 Scene 类。在 construct 方法中,我们创建了一个 Axes 对象,并进行了一些配置,如 x 和 y 轴的范围、长度和样式。然后,我们将 axes 添加到场景中,并使用 self.wait() 使场景保持不变。\n\n你可以根据自己的需求进行进一步的配置,例如添加网格线、坐标轴标签等。


原文地址: https://www.cveoy.top/t/topic/pK2c 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录