geom_normalviolin: Creates normal violins with specified means and standard...

Description Usage Arguments Aesthetics Examples

View source: R/main.R

Description

Creates normal violins with specified means and standard deviations

Usage

1
2
3
4
5
6
geom_normalviolin(mapping = NULL, data = NULL, nsigma = 4,
  p_tail = 0, p_lower_tail = p_tail/2, p_upper_tail = p_tail/2,
  tail_fill = "black", tail_alpha = 0.4, width = 0.6,
  upper_limit = NA, lower_limit = NA, face_left = TRUE,
  face_right = TRUE, na.rm = FALSE, show.legend = NA,
  inherit.aes = TRUE, ...)

Arguments

mapping

Set of aesthetic mappings created by aes() or aes_(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

data

The data to be displayed in this layer. There are three options:

If NULL, the default, the data is inherited from the plot data as specified in the call to ggplot().

A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See fortify() for which variables will be created.

A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)).

nsigma

The number of standard deviations each violin should extend

p_tail

The 2-tailed proportion that should be highlighted. Can be overridden with p_lower_tail and/or p_upper_tail

p_lower_tail

The proportion of the distribution that should be highlighted in the lower tail. Defaults to half of 'p_tail'.

p_upper_tail

The proportion of the distribution that should be highlighted in the upper tail. Defaults to half of 'p_tail'.

tail_fill

fill color for tails

tail_alpha

alpha value for tails

width

Width of normal violin

upper_limit

upper limit for polygons. Needed in case setting limits in scale_y_continuous or ylim distorts the polygons.

lower_limit

lower limit for polygons. Needed in case setting limits in scale_y_continuous or ylim distorts the polygons.

face_left

Display left half of violins. Defaults to 'TRUE'

face_right

Display right half of violins. Defaults to 'TRUE'

na.rm

If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders().

...

Other arguments passed on to layer(). These are often aesthetics, used to set an aesthetic to a fixed value, like colour = "red" or size = 3. They may also be parameters to the paired geom/stat.

Aesthetics

geom_normviolin understands the following aesthetics (required aesthetics are in bold):

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(ggplot2)
library(ggnormalviolin)

d <- data.frame(
  Distribution = c("A", "B"),
  Distribution_mean = c(80, 90),
  Distribution_sd = c(15, 10)
)

ggplot(data = d, aes(x = Distribution)) +
  geom_normalviolin(aes(mu = Distribution_mean,
                      sigma = Distribution_sd))

ggnormalviolin documentation built on May 28, 2019, 1:01 a.m.