Skip to contents

A 1D number line with tick marks, optional tick labels, and tips. Maps numeric values to scene coordinates via n2p (number to point).

Super classes

manimR::MObject -> manimR::VMobject -> NumberLine

Public fields

x_range

c(min, max, step)

length

Length in scene units

include_ticks

Whether to include tick marks

tick_size

Height of tick marks

include_numbers

Whether to include number labels

numbers_to_include

Specific numbers to label (NULL = auto from step)

include_tip

Whether to include arrow tip at max end

font_size

Font size for number labels

label_direction

Direction to place labels relative to line

tick_marks

List of tick mark VMobjects

number_labels

List of number label mobjects

Methods

Inherited methods


Method new()

Create a NumberLine

Usage

NumberLine$new(
  x_range = c(-5, 5, 1),
  length = 10,
  color = WHITE,
  include_ticks = TRUE,
  tick_size = 0.1,
  include_numbers = FALSE,
  numbers_to_include = NULL,
  include_tip = FALSE,
  font_size = 24,
  label_direction = NULL,
  ...
)

Arguments

x_range

c(min, max, step)

length

Line length in scene units

color

Line color

include_ticks

Include tick marks

tick_size

Tick mark height

include_numbers

Include number labels

numbers_to_include

Specific numbers to label

include_tip

Include arrow tip

font_size

Label font size

label_direction

Direction for labels (default DOWN)

...

Additional args


Method n2p()

Number to Point: map a numeric value to scene coordinates

Usage

NumberLine$n2p(value)

Arguments

value

Numeric value

Returns

Scene coordinate c(x, y, z)


Method p2n()

Point to Number: inverse of n2p

Usage

NumberLine$p2n(point)

Arguments

point

Scene coordinate c(x, y, z)

Returns

Numeric value


Method get_tick()

Get tick mark at a specific value

Usage

NumberLine$get_tick(value)

Arguments

value

The value


Method add_label()

Add a specific label at a value

Usage

NumberLine$add_label(value, label = NULL, direction = NULL)

Arguments

value

Numeric value

label

Text label (defaults to formatted value)

direction

Direction offset from tick


Method clone()

The objects of this class are cloneable with this method.

Usage

NumberLine$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.