manim.mobject.number_line.NumberLine

class NumberLine(x_range=None, length=None, unit_size=1, include_ticks=True, tick_size=0.1, numbers_with_elongated_ticks=[], longer_tick_multiple=2, color='#BBBBBB', rotation=0, stroke_width=2.0, include_tip=False, tip_width=0.25, tip_height=0.25, include_numbers=False, label_direction=array([0.0, - 1.0, 0.0]), line_to_number_buff=0.25, decimal_number_config={'font_size': 24, 'num_decimal_places': 0}, numbers_to_exclude=[], number_scale_value=0.75, **kwargs)[source]

Bases: manim.mobject.geometry.Line

Creates a number line with tick marks.

Parameters
  • x_range (Union[list, numpy.ndarray]) – The [x_min, x_max, x_step] values to create the line.

  • length (float) – The length of the number line.

  • unit_size (class:float) – The distance between each tick of the line.

  • include_ticks (bool) – Determines whether ticks are included.

  • tick_size (float) – The vertical length of each tick mark.

  • numbers_with_elongated_ticks (Union[list, numpy.ndarray]) – A list of specific values with elongated ticks.

  • longer_tick_multiple (float) – Influences how many times larger elongated ticks are than regular ticks (2 = 2x).

  • color (Colors) – The color of the line.

  • rotation (float) – The angle (in radians) at which the line is rotated.

  • stroke_width (float) – The thickness of the line.

  • include_tip (bool) – Determines whether a tip is added to the end of the line.

  • tip_width (float) – The width of the tip.

  • tip_height (float) – The height of the tip.

  • include_numbers (bool) – Determines whether numbers are added to tick marks.

  • label_direction (Union[list, numpy.ndarray]) – The specific position to which number mobjects are added on the line.

  • line_to_number_buff (float) – The distance between the line and the number mobject.

  • decimal_number_config (dict) – Arguments that can be passed to DecimalNumber to influence number mobjects.

  • numbers_to_exclude (Union[list, numpy.ndarray]) – An explicit list of numbers to not be added to the line.

  • number_scale_value (float) – The size scaling factor for the number mobjects.

  • kwargs (Any) – Additional arguments to be passed to Line.

Returns

The constructed number line.

Return type

NumberLine

Methods

add_numbers

add_ticks

get_labels

get_number_mobject

get_number_mobjects

get_tick

get_tick_marks

get_tick_range

get_unit_size

get_unit_vector

n2p

Abbreviation for number_to_point

number_to_point

p2n

Abbreviation for point_to_number

point_to_number

rotate_about_number

rotate_about_zero

Attributes

animate

Used to animate the application of a method.

depth

The depth of the mobject.

height

The height of the mobject.

width

The width of the mobject.

n2p(number)[source]

Abbreviation for number_to_point

p2n(point)[source]

Abbreviation for point_to_number