Skip to contents

The dplot functions plot data passed to a gadget3 model instead of data from the model or fit objects.

Usage

dplot_aldist(
  x,
  type = "bar",
  facet_age = FALSE,
  scales = "fixed",
  ncol = NULL,
  color_palette = scales::brewer_pal(palette = "Set1"),
  base_size = 8
)

Arguments

x

A gadget3 ready data frame created using mfdb, g3_data or add_g3_attributes.

type

Character specifying the plot type: "bar" or "area".

facet_age

Logical indicating whether ages should be plotted in separate facets

scales

Character defining the facet_wrap scales argument to use.

ncol

Number of columns passed to facet_wrap

color_palette

A function defining the color palette to be used for fill of bars when facet_age = TRUE. See scale_color_manual. To adjust color when facet_age = FALSE, use the standard ggplot2::scale_fill_* functions.

base_size

Base size parameter for ggplot. See ggtheme.

Value

A ggplot object.

Examples

data(aldist_example)
dplot_aldist(aldist_example)

dplot_aldist(aldist_example, facet_age = TRUE)

dplot_aldist(aldist_example, type = "area") # works poorly