summary_plot: Secondary scale for strat.plot

View source: R/summary_plot.R

summary_plotR Documentation

Secondary scale for strat.plot

Description

Adds a secondary scale for strat.plot

Usage

summary_plot(
  x,
  g,
  yvar,
  xLeft = 0.8,
  xRight = 1,
  y.axis = FALSE,
  ylabel = "",
  cex.ylabel = 1,
  x.name.pos,
  srt.xlabel = 90,
  cex.xlabel = 1,
  fill
)

Arguments

x

a stratigraphic diagram object produced by strat.plot.

g

matrix or data.frame with summary groups. Column names will be used as labels.

yvar

y variable. Same as main plot.

xLeft

Position of plot. See strat.plot

xRight

ditto

y.axis

ditto

ylabel

ditto

cex.ylabel

ditto

x.name.pos

numeric. Position of names. Defaults to midpoint of uppermost sample.

srt.xlabel

See strat.plot

cex.xlabel

ditto

fill

vector of colours. Defaults to RcolourBrewer Set1

Details

secondary.scale

Examples

 library(rioja)
 library(dplyr)
 data(RLGH)
 fos <- RLGH$spec
 chron <- RLGH$depths

 groups <- case_when(
   substr(names(fos), 1, 1) %in% c("A", "E") ~ "Vowel",
   substr(names(fos), 1, 1) %in% c("B", "C", "F") ~ "BCF",
   TRUE ~ "NPT"
 ) %>%
   factor(levels = c("Vowel", "BCF", "NPT"))

  g <- sapply(levels(groups), function(lev){
    rowSums(fos[, groups == lev, drop = FALSE])
    })


 pt <- strat.plot(fos, yvar = chron$Depth, y.rev = TRUE,
                  xLeft = .1, xRight = 0.8, scale.percent = TRUE)

 summary_plot(pt, g = g, yvar = chron$Depth, xLeft = 0.8)

richardjtelford/ggpalaeo documentation built on Nov. 7, 2022, 11:03 p.m.