Plot a maze object
# S3 method for maze
plot(x, walls = FALSE, ...)# S3 method for maze
lines(
x,
walls = FALSE,
adjust = c(0, 0),
openings = NULL,
openings_direction = NULL,
...
)
A maze
object.
logical value, indicating that the walls of the maze should be
plotted, rather than the paths through the maze. Default is FALSE
.
Additional arguments passed to lines
A vector by which to adjust the overall position of the maze.
Should be a numeric vector of length 2, indicating the x
and
y
adjustments, respectively.
Locations in the maze where a certain wall(s) should not be
drawn (only applies when walls = TRUE
). May be specified as
coordinates, or as a relative description (see
find_maze_refpoint
)
Character vector describing which walls should not
be drawn at the locations specified by openings
. See Details.
Returns NULL
, invisibly.
When plotting, the coordinates for locations in the maze are taken from the indices of the corresponding locations in the matrix representation. This means that the plot will appear to be flipped vertically relative to the matrix representation of the maze.
The openings_direction
argument specifies where to create an
opening (ie. where not to draw walls), relative to a location in the maze
given by openings
. Possible values are: "left"
,
"right"
, "top"
, "bottom"
, "topleft"
,
"topright"
, "bottomright"
, "bottomleft"
, and
"all"
. If not specified, this will be set as the first value in
c("left","right","top","bottom")
to reference a wall that would
otherwise have been drawn.
# NOT RUN {
m <- maze(10,10)
plot(m, walls = TRUE)
lines(m, lwd = 5, col = 3)
# }
Run the code above in your browser using DataLab