ggpk_ribbons: ggplot wrapper for plotting ribbon, taking a stats string or...

Description Usage Arguments Value Note Author(s) Examples

Description

ggplot wrapper for plotting ribbon, taking a stats string or function set as an argument

Usage

1
2
ggpk_ribbons(mapping = NULL, data = NULL, show.counts = FALSE,
  fun.data = "mean_se", fun.args = list(), id = "ggpk_ribbons", ...)

Arguments

mapping

a ggplot aesthetic mapping

data

data to pass to ggplot2::ggplot2::stat_summary functions

show.counts

True, False, "label" or "table" to display either as labels at each datapoint or as a table at the top of the plot

fun.data

argument to be passed to stat_summary calls

fun.args

list of argumnets to be passed to stat_summary calls

id

ggpackets id to indentify arguments which should be passed to all ggpk_ribbons ggplot2 layers. Defaults to 'ggpk_ribbons'.

...

Arguments prefixed with the following ids will be parsed and passed to the following calls:

  • ggpk_ribbons, ribbon ids: Passed to call to geom_ribbon. color and alpha fixed.

  • ggpk_ribbons, ribbon ids: Passed to call to geom_ribbon. fun.data, color and alpha fixed.

  • ggpk_ribbons, point ids: Passed to call to geom_point.

  • ggpk_ribbons, line ids: Passed to call to geom_line.

  • ggpk_ribbons, label ids: Passed to call to geom_label_repel. direction, nudge_y, label.size, fill and alpha fixed.

  • ggpk_ribbons, label ids: Passed to call to geom_label. label.size, fill and alpha fixed.

  • ggpk_ribbons, label ids: Passed to call to geom_text_table. show.legend fixed.

Value

a ggpacket object that can be added to any ggplot to draw a collection of layers

Note

When specifying arguments for wrapped ggplot geometries, id the parameter with geometry specifiers: "ribbon" for ribbon geometry "line" for central line geometry, or "label" for count labels. e.g. ggpk_stat_ribbon(ribbon.alpha = 0.8, line.alpha = 0.6)

Author(s)

Doug Kelkhoff kelkhoff.douglas@gene.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(dplyr)
library(ggplot2)

nasa %>%
  as.data.frame() %>%
  mutate(date = as.Date(sprintf("%04d%02d01", year, month), "%Y%m%d")) %>%
  mutate(hemisphere = ifelse(lat > 0,"Northern", "Southern")) %>%
  mutate(temperature = temperature - 273) %>%

  # plotting
  ggplot() +
    aes(x = date, y = temperature) +
    ggpk_ribbons(fun.data = "deciles") +
    facet_grid(hemisphere ~ .) +
    labs(title = "Temperature by Hemisphere")

lengning/gClinBiomarker documentation built on May 9, 2019, 2:55 p.m.