ch.addLegend: A function to add a legend to a plot

ch.addLegendR Documentation

A function to add a legend to a plot

Description

This function adds a legend to a plot.

Usage

ch.addLegend(
  df.legend,
  grpCols,
  placement = "topright",
  horiz = T,
  lwd = 1,
  cexLegend = 0.5,
  bty = "n",
  includeTitle = T,
  inset = c(-0.3, 0),
  ...
)

Arguments

df.legend

a legend dataframe created by ch.getPlotLegendVals().

grpCols

a vector of strings that specifies the names of the column in "df.legend" that contain the grouping variables that are plotted.

placement

the placement of the legend: "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center". DEFAULT = "topright"

horiz

a boolean to draw the legend horizontal (vs vertical). DEFAULT = T.

lwd

see par for more info. DEFAULT = 1.

bty

see par for more info. DEFAULT = "n"

includeTitle

a boolean to add a title to the legend. DEFAULT = T.

cex

see par for more info. DEFAULT = .5.

Value

.

Examples

ch.addLegend(df.legend, c("cond1", "cond2"))

ccpluncw/ccpl_R_chutils documentation built on Feb. 28, 2024, 1:17 a.m.