summary_plot: Secondary scale for strat.plot

Description Usage Arguments Details Examples

View source: R/summary_plot.R

Description

Adds a secondary scale for strat.plot

Usage

1
2
3
summary_plot(g, yvar, ylim = NULL, y.rev = FALSE, xLeft = 0.8,
  xRight = 1, yBottom = 0.07, yTop = 0.8, y.axis = FALSE, ylabel = "",
  cex.ylabel = 1, x.name.pos, srt.xlabel = 90, cex.xlabel = 1, fill)

Arguments

g

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

yvar

y variable. Same as main plot.

ylim

y limits. Defaults to range of data.

y.rev

logical. Reverse y-axis. Do as in main plot.

xLeft

Position of plot. See strat.plot

xRight

ditto

yBottom

ditto

yTop

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
 library(rioja)
 library(tidyverse)
 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])
    })


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

 summary_plot(g = g, yvar = chron$Depth, y.rev = TRUE, xLeft = 0.8)

richardjtelford/ggpalaeo documentation built on Dec. 7, 2018, 7:55 a.m.