Learn R Programming

TurtleGraphics (version 1.0-8)

turtle_init: Set Up a New, Shiny Terrarium

Description

This function creates a new empty plot with the Turtle centered on the board and facing to the north.

Usage

turtle_init(width = 100, height = 100, mode = c("error", "clip", "cycle"))

Arguments

width

numeric; plot width.

height

numeric; plot height.

mode

character string; one of "error", "clip", or "cycle".

Details

The mode argument determines what happens if the Turtle tries to move outside the terrarium. clip allows it to do that, but the drawing will be clipped to the predefined plot region. error throws an error. cycle makes the Turtle appear on the other side of the board.

After the turtle_init() function has been called you can e.g. move the Turtle with the turtle_forward function, turn its direction with turtle_right or set display parameters of the Turtle's trace, see turtle_param.

See Also

Other TurtleGraphics: TurtleGraphics-package, turtle_do, turtle_getpos, turtle_goto, turtle_move, turtle_param, turtle_reset, turtle_show, turtle_status, turtle_turn, turtle_up