Skip to content

Commit

Permalink
Add big_tick_spacing option NumberLine
Browse files Browse the repository at this point in the history
  • Loading branch information
3b1b committed Feb 22, 2024
1 parent 4a89376 commit e784c42
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions manimlib/mobject/number_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
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


Expand All @@ -28,12 +28,13 @@ def __init__(
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,
Expand All @@ -54,7 +55,14 @@ def __init__(
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
Expand Down

0 comments on commit e784c42

Please sign in to comment.