ggplot_addcrosshairs: Add datapoints/crosshairs to an existing plot

View source: R/utility_crosshairs.R

ggplot_addcrosshairsR Documentation

Add datapoints/crosshairs to an existing plot

Description

Function takes an existing ggplot and add points and/or crosshairs to the plot to show the position of points

Usage

ggplot_addcrosshairs(
  plt,
  x,
  y,
  group = NULL,
  legend_title = NULL,
  legend_position = "none",
  crosshairs = TRUE,
  add_colour_scale = FALSE,
  xlim = 0,
  ylim = 0,
  arrow_x = TRUE,
  arrow_y = TRUE,
  arrow_length = 0.1,
  palette = "Set1",
  label_size = 4,
  label_hjust = 0,
  label_vjust = 0,
  label_nudge_x = 0,
  label_nudge_y = 0,
  label_parse = FALSE
)

Arguments

plt

a ggplot object

x

x-coordinates for all points

y

y-coordinates for all points

group

names of group, for all points - this is plotted in the label

legend_title

title for legend

legend_position

legend position. If 'NULL', no legend is drawn

crosshairs

if 'TRUE', plot crosshairs for each data point

add_colour_scale

if 'TRUE', add new color scale for different crosshairs

xlim

start point of x crosshairs

ylim

start point of y crosshairs

arrow_x, arrow_y

if 'TRUE', point x or y-arrows towards the point. If 'FALSE', points towards the axis

arrow_length

length of arrow heads

palette

RColorBrewer color palette to use

label_size

text size in label

label_hjust

horizontal justification of labels

label_vjust

vertical justification of labels

label_nudge_x

x-offset of labels

label_nudge_y

y-offset of labels

label_parse

if 'TRUE', parse label text


GJMeijer/soilmech documentation built on May 22, 2022, 10:39 a.m.