ggpk_line_errorbar: 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
3
4
ggpk_line_errorbar(mapping = NULL, data = NULL, show.counts = FALSE,
  fun.data = "mean_se", fun.args = list(),
  position = ggplot2::position_dodge(width = ggplot2::rel(0.5)),
  id = "ggpk_line_errorbar", ...)

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

position

PositionDodge object (constructed using position_dodge()) to be used for positioning errorbars

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_line_errorbar, errorbar ids: Passed to call to geom_errorbar. width fixed.

  • ggpk_line_errorbar, errorbar ids: Passed to call to geom_errorbar. alpha, linetype, position, width, fun.data and size fixed.

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

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

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

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

  • ggpk_line_errorbar, 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, prefix the parameter with geometry specifiers: "ribbons" for ribbon geometry "line" for central line geometry, or "label" for count labels. e.g. ggpk_stat_line_errorbar(ribbons.alpha = 0.8, line.alpha = 0.6)

Author(s)

Doug Kelkhoff [email protected]

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_line_errorbar(fun.data = 'quartiles') +
    facet_grid(hemisphere ~ .) +
    labs(title="Temperature by Hemisphere")

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