geom_node {chessboard}R Documentation

Highlight a node on a chessboard

Description

Highlights a node (cell) on a chessboard plotted with gg_chessboard().

Usage

geom_node(nodes, focus)

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.

Value

A list of two geom_point that must be added to a ggplot2 object.

Examples

library("chessboard")

# Two-dimensional sampling ----
sites_infos <- expand.grid("transect" = 1:3, "quadrat" = 1:5)

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

gg_chessboard(nodes) +
  geom_node(nodes, "2-3")

# One-dimensional sampling (only transects) ----
sites_infos <- data.frame("transect" = 1:5)

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

gg_chessboard(nodes) +
  geom_node(nodes, "3-1")

[Package chessboard version 0.1 Index]