DecimalMatrix

限定名称: manim.mobject.matrix.DecimalMatrix

class DecimalMatrix(matrix, element_to_mobject=<class 'manim.mobject.text.numbers.DecimalNumber'>, element_to_mobject_config={'num_decimal_places': 1}, **kwargs)[来源]

基础:Matrix

一个在屏幕上显示带有十进制条目的矩阵的mobject。

示例

示例:DecimalMatrixExample

../_images/DecimalMatrixExample-1.png
from manim import *

class DecimalMatrixExample(Scene):
    def construct(self):
        m0 = DecimalMatrix(
            [[3.456, 2.122], [33.2244, 12]],
            element_to_mobject_config={"num_decimal_places": 2},
            left_bracket="\{",
            right_bracket="\}")
        self.add(m0)
class DecimalMatrixExample(Scene):
    def construct(self):
        m0 = DecimalMatrix(
            [[3.456, 2.122], [33.2244, 12]],
            element_to_mobject_config={"num_decimal_places": 2},
            left_bracket="\{",
            right_bracket="\}")
        self.add(m0)

将根据提供的配置对小数位进行四舍五入/截断。

Parameters:
  • matrix (可迭代对象) – 一个numpy的二维数组或列表的列表

  • element_to_mobject (Mobject) – 要使用的Mobject,默认为DecimalNumber

  • element_to_mobject_config (dict[str, Mobject]) – 所需mobject的配置,默认为{“num_decimal_places”: 1}

方法

属性

animate

用于动画化self的任何方法的应用。

animation_overrides

color

depth

mobject的深度。

fill_color

如果有多种颜色(用于渐变),则返回第一个颜色

height

mobject的高度。

n_points_per_curve

sheen_factor

stroke_color

width

mobject的宽度。

_original__init__(matrix, element_to_mobject=<class 'manim.mobject.text.numbers.DecimalNumber'>, element_to_mobject_config={'num_decimal_places': 1}, **kwargs)

将根据提供的配置对小数位进行四舍五入/截断。

Parameters:
  • matrix (可迭代对象) – 一个numpy的二维数组或列表的列表

  • element_to_mobject (Mobject) – 要使用的Mobject,默认为DecimalNumber

  • element_to_mobject_config (dict[str, Mobject]) – 所需mobject的配置,默认为{“num_decimal_places”: 1}