mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Add big_tick_spacing option NumberLine
This commit is contained in:
parent
4a89376fdd
commit
e784c42f0d
1 changed files with 11 additions and 3 deletions
|
@ -16,7 +16,7 @@ from manimlib.utils.simple_functions import fdiv
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Iterable
|
||||
from typing import Iterable, Optional
|
||||
from manimlib.typing import ManimColor, Vect3, Vect3Array, VectN, RangeSpecifier
|
||||
|
||||
|
||||
|
@ -28,12 +28,13 @@ class NumberLine(Line):
|
|||
stroke_width: float = 2.0,
|
||||
# How big is one one unit of this number line in terms of absolute spacial distance
|
||||
unit_size: float = 1.0,
|
||||
width: float | None = None,
|
||||
width: Optional[float] = None,
|
||||
include_ticks: bool = True,
|
||||
tick_size: float = 0.1,
|
||||
longer_tick_multiple: float = 1.5,
|
||||
tick_offset: float = 0.0,
|
||||
# Change name
|
||||
big_tick_spacing: Optional[float] = None,
|
||||
numbers_with_elongated_ticks: list[float] = [],
|
||||
include_numbers: bool = False,
|
||||
line_to_number_direction: Vect3 = DOWN,
|
||||
|
@ -54,7 +55,14 @@ class NumberLine(Line):
|
|||
self.tick_size = tick_size
|
||||
self.longer_tick_multiple = longer_tick_multiple
|
||||
self.tick_offset = tick_offset
|
||||
self.numbers_with_elongated_ticks = list(numbers_with_elongated_ticks)
|
||||
if big_tick_spacing is not None:
|
||||
self.numbers_with_elongated_ticks = np.arange(
|
||||
x_range[0],
|
||||
x_range[1] + big_tick_spacing,
|
||||
big_tick_spacing,
|
||||
)
|
||||
else:
|
||||
self.numbers_with_elongated_ticks = list(numbers_with_elongated_ticks)
|
||||
self.line_to_number_direction = line_to_number_direction
|
||||
self.line_to_number_buff = line_to_number_buff
|
||||
self.include_tip = include_tip
|
||||
|
|
Loading…
Add table
Reference in a new issue