(
self,
table: Iterable[Iterable[float | str | VMobject]],
row_labels: Iterable[VMobject] | None = None,
col_labels: Iterable[VMobject] | None = None,
top_left_entry: VMobject | None = None,
v_buff: float = 0.8,
h_buff: float = 1.3,
include_outer_lines: bool = False,
add_background_rectangles_to_entries: bool = False,
entries_background_color: ParsableManimColor = BLACK,
include_background_rectangle: bool = False,
background_rectangle_color: ParsableManimColor = BLACK,
element_to_mobject: Callable[
[float | str | VMobject],
VMobject,
] = Paragraph,
element_to_mobject_config: dict = {},
arrange_in_grid_config: dict = {},
line_config: dict = {},
**kwargs,
)
| 185 | """ |
| 186 | |
| 187 | def __init__( |
| 188 | self, |
| 189 | table: Iterable[Iterable[float | str | VMobject]], |
| 190 | row_labels: Iterable[VMobject] | None = None, |
| 191 | col_labels: Iterable[VMobject] | None = None, |
| 192 | top_left_entry: VMobject | None = None, |
| 193 | v_buff: float = 0.8, |
| 194 | h_buff: float = 1.3, |
| 195 | include_outer_lines: bool = False, |
| 196 | add_background_rectangles_to_entries: bool = False, |
| 197 | entries_background_color: ParsableManimColor = BLACK, |
| 198 | include_background_rectangle: bool = False, |
| 199 | background_rectangle_color: ParsableManimColor = BLACK, |
| 200 | element_to_mobject: Callable[ |
| 201 | [float | str | VMobject], |
| 202 | VMobject, |
| 203 | ] = Paragraph, |
| 204 | element_to_mobject_config: dict = {}, |
| 205 | arrange_in_grid_config: dict = {}, |
| 206 | line_config: dict = {}, |
| 207 | **kwargs, |
| 208 | ): |
| 209 | self.row_labels = row_labels |
| 210 | self.col_labels = col_labels |
| 211 | self.top_left_entry = top_left_entry |
| 212 | self.row_dim = len(table) |
| 213 | self.col_dim = len(table[0]) |
| 214 | self.v_buff = v_buff |
| 215 | self.h_buff = h_buff |
| 216 | self.include_outer_lines = include_outer_lines |
| 217 | self.add_background_rectangles_to_entries = add_background_rectangles_to_entries |
| 218 | self.entries_background_color = ManimColor(entries_background_color) |
| 219 | self.include_background_rectangle = include_background_rectangle |
| 220 | self.background_rectangle_color = ManimColor(background_rectangle_color) |
| 221 | self.element_to_mobject = element_to_mobject |
| 222 | self.element_to_mobject_config = element_to_mobject_config |
| 223 | self.arrange_in_grid_config = arrange_in_grid_config |
| 224 | self.line_config = line_config |
| 225 | |
| 226 | for row in table: |
| 227 | if len(row) == len(table[0]): |
| 228 | pass |
| 229 | else: |
| 230 | raise ValueError("Not all rows in table have the same length.") |
| 231 | |
| 232 | super().__init__(**kwargs) |
| 233 | mob_table = self._table_to_mob_table(table) |
| 234 | self.elements_without_labels = VGroup(*it.chain(*mob_table)) |
| 235 | mob_table = self._add_labels(mob_table) |
| 236 | self._organize_mob_table(mob_table) |
| 237 | self.elements = VGroup(*it.chain(*mob_table)) |
| 238 | |
| 239 | if len(self.elements[0].get_all_points()) == 0: |
| 240 | self.elements.remove(self.elements[0]) |
| 241 | |
| 242 | self.add(self.elements) |
| 243 | self.center() |
| 244 | self.mob_table = mob_table |
no test coverage detected