geom_edges {chessboard}R Documentation

Link neighbors by arrow on a chessboard

Description

Links neighbors (cells) on a chessboard plotted with gg_chessboard().

Usage

geom_edges(nodes, focus, neighbors)

Arguments

nodes

a data.frame with (at least) the following three columns: node, transect, and quadrats. Must be the output if the function create_node_labels().

focus

an character of length 1. The node label to be emphasized on the chessboard. Must exist in the nodes object.

neighbors

a data.frame with the following at least three columns: node, transect, and quadrats. See pawn(), fool(), etc. for further information.

Value

A geom_segment that must be added to a ggplot2 object.

Examples

library("chessboard")

sites_infos <- expand.grid("transect" = 1:9, "quadrat" = 1:9)

nodes <- create_node_labels(data     = sites_infos, 
                            transect = "transect", 
                            quadrat  = "quadrat")

focus <- "5-5"

neighbors <- wizard(nodes, focus = focus, degree = 4, directed = FALSE, 
                    reverse = TRUE)

gg_chessboard(nodes) +
  geom_neighbors(nodes, neighbors) +
  geom_edges(nodes, focus, neighbors) +
  geom_node(nodes, focus)

[Package chessboard version 0.1 Index]