如何更改tip_width和tip_height numberline? (Manim V0.15.2)

发布于 2025-01-25 03:35:32 字数 745 浏览 2 评论 0原文

(嗨。这是我在堆栈溢出上的第一个问题,所以请让我知道问题是否尚不清楚。)

我试图使数字暴民的箭头小于默认值(tip_width = 0.25,tip_height = 0.25) 。 但是,提示自定义似乎不起作用。 这是代码和结果:

from manim import *

class NumberLineComparison(Scene):
  def construct(self):

    l0 = NumberLine(
      x_range=[-3,3],
      include_tip=True
    )

    l1 = NumberLine(
      x_range=[-3,3],
      include_tip=True,
      tip_width=0.1
    ).next_to(l0,DOWN)
    
    l2 = NumberLine(
      x_range=[-3,3],
      include_tip=True,
      tip_height=0.1
    ).next_to(l1,DOWN)

    self.add(l0,l1,l2)

结果图像

tip_width和tip_height and tip_height属性的更改似乎是活跃的...

这是一个错误还是语法有任何问题?

(Hi. This is my very first question on stack overflow so please let me know if the question is unclear.)

I am trying to make the arrowhead of a NumberLine mobject smaller than its default (which is tip_width = 0.25, tip_height = 0.25).
However the tip customization doesn't seem to be working.
Here is the code and the result:

from manim import *

class NumberLineComparison(Scene):
  def construct(self):

    l0 = NumberLine(
      x_range=[-3,3],
      include_tip=True
    )

    l1 = NumberLine(
      x_range=[-3,3],
      include_tip=True,
      tip_width=0.1
    ).next_to(l0,DOWN)
    
    l2 = NumberLine(
      x_range=[-3,3],
      include_tip=True,
      tip_height=0.1
    ).next_to(l1,DOWN)

    self.add(l0,l1,l2)

Resulting Image

The changes in tip_width and tip_height attributes don't seem to be active...

Is this a bug or are there any problems with the syntax?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱,才寂寞 2025-02-01 03:35:32

您需要在AXIS_CONFIG参数中定义属性。这是一个最小的工作示例:

class NumberPlaneTips(Scene):    
def construct(self):        
    grid = NumberPlane(
        x_range=[-2,5],
        y_range=[-2,5],
        axis_config={
            "include_numbers": True,
            "tip_width": 0.15, # adjust this
            "tip_height": 0.15, # and this
            "include_ticks": True,
            "tick_size": 0.05,
            "include_numbers": True,
            "include_tip": True, # Add a tip to x-axis and y-axis
        },
        
    )

    self.add(grid)

您还可以单独操纵X轴和Y轴子对象,如下...

class NumberPlaneTips(Scene):    
def construct(self):        
    grid = NumberPlane(
        x_range=[-2,5],
        y_range=[-2,5],
        x_axis_config={
            # do stuff for x-axis
        },
        y_axis_config={
            # do stuff for y-axis
        },            
    )

    self.add(grid)

You need to define the attributes in the axis_config parameter. Here's a minimal working example:

class NumberPlaneTips(Scene):    
def construct(self):        
    grid = NumberPlane(
        x_range=[-2,5],
        y_range=[-2,5],
        axis_config={
            "include_numbers": True,
            "tip_width": 0.15, # adjust this
            "tip_height": 0.15, # and this
            "include_ticks": True,
            "tick_size": 0.05,
            "include_numbers": True,
            "include_tip": True, # Add a tip to x-axis and y-axis
        },
        
    )

    self.add(grid)

You can also manipulate the x-axis and y-axis sub-Mobject individually, as follows ...

class NumberPlaneTips(Scene):    
def construct(self):        
    grid = NumberPlane(
        x_range=[-2,5],
        y_range=[-2,5],
        x_axis_config={
            # do stuff for x-axis
        },
        y_axis_config={
            # do stuff for y-axis
        },            
    )

    self.add(grid)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文