scandal_whiskers_plot: Create a box-and-whiskers plot

Description Usage Arguments Value Author(s) Examples

View source: R/plotting.R

Description

This function depicts the distribution of data within groups using a box and whiskers diagram. Each box depicts the interquantile distribution within a group while the whiskers depict the distribution in the upper and lower quartiles.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
scandal_whiskers_plot(
  data,
  labels,
  title = NULL,
  xlab = NULL,
  ylab = NULL,
  palette = NULL,
  legend_name = NULL,
  title_text_size = 20
)

Arguments

data

a numeric vector of observations.

labels

a vector of label per observation in data used to spilt data into the different groups.

title

an optional string for the title of the plot. Default is NULL (no title).

xlab

a label for the x axis. Default is NULL (no label).

ylab

a label for the y axis. Default is NULL (no label).

palette

an optional color palette used instead of ggplot's default palette. Default is NULL.

legend_name

the name of the leged. Default is NULL (no label).

title_text_size

text size of the title. Default is 20.

Value

A ggplot2 object representing the histogram plot.

Author(s)

Avishay Spitzer

Examples

1
2
3
4
5
6
7
8
# Generate 1K normally distributed data points
y <- rnorm(1000, mean = 5, sd = 1)

# Randomlly assign each data point to a group
labels <- paste0("Group", sample(x = 1:5, size = 1000, replace = TRUE))

# Plot the distribution
scandal_whiskers_plot(y, labels)

dravishays/scandal documentation built on Jan. 8, 2020, 1:30 p.m.