plot_mcmc_histogram: Plot a histogram for a given column in a data frame

View source: R/plot-mcmc-histogram.R

plot_mcmc_histogramR Documentation

Plot a histogram for a given column in a data frame

Description

Plot a histogram for a given column in a data frame

Usage

plot_mcmc_histogram(
  d,
  col_nm,
  x_lab = col_nm,
  y_lab = "Count",
  barplot = FALSE,
  lvls = NULL,
  scale_effn = 1,
  show_ro = FALSE,
  show_bar_values = TRUE,
  ro_arrow_length = 20,
  ro_text_nudge = 0,
  ro_text_size = 5,
  bar_label_limit = 10,
  bar_text_color = "navyblue",
  bar_text_size = 2,
  x_lim = NULL,
  y_lim = NULL,
  x_breaks = NULL,
  y_breaks = NULL,
  x_brk = 0.1,
  y_brk = 20,
  ...
)

Arguments

d

A dta frame containing the column with name col_nm which contains the values to use in the plot

col_nm

The name of the column in dcontaining the values to use in the plot

x_lab

The label to show on the x-axis

y_lab

The label to show on the y-axis

barplot

Logical. If TRUE, return a ggplot2::geom_bar(), which is used for character columns (discrete data). If FALSE, return a ggplot2::geom_histogram() which is for numerical data (continuous data)

lvls

A vector of levels that should appear in the data if barplot is TRUE. If NULL, the data will be plotted as-is

scale_effn
show_ro

Logical. If TRUE, make a label with arrow showing which bin the R0 parameter is in

ro_arrow_length

The length in count units (y-axis units) of the arrow pointing to the bin that the R0 parameter is in. Only used if show_ro is TRUE

ro_text_nudge

Amount to nudge to the left(negative) or right (positive) the R0 location label

ro_text_size

The font size for the R0 labels

bar_label_limit

The number in a bin (count - y-axis), above which the label of the count for the bar is in white in the middle of the bar vertically. Below this value, the bar value will be above the bar. To have all value labels above the bars, set this to a value larger than the highest count bin

bar_text_color

The color of the count labels for each bar. Only used if show_bar_values is TRUE

bar_text_size

The font size of the count labels for each bar. Only used if show_bar_values is TRUE

x_lim

A vector of two values. The min and max to show on the x-axis. If NULL, values will be calculated from the input values

y_lim

A vector of two values. The min and max to show on the y-axis. If NULL, values will be calculated from the input values

x_breaks

A vector of values to show on the x-axis. If NULL, values will be calculated from the input values

y_breaks

A vector of values to show on the y-axis. If NULL, values will be calculated from the input values

x_brk

A value to use to create the x_breaks values if it is NULL. This value is used as the by argument like this: seq(xlim[1], xlim[2], by = x_brk). This is also used as the binwidth in the ggplot2::geom_histogram() call

y_brk

A value to use to create the y_breaks values if it is NULL. This value is used as the by argument like this: seq(ylim[1], ylim[2], by = y_brk)

...

Additional arguments to pass to the plotting functions ggplot2::geom_histogram() and ggplot2::geom_bar()

Value

A ggplot2::ggplot() object


pacific-hake/hake-assessment documentation built on July 21, 2024, 8:19 a.m.