Learn R Programming

WVPlots (version 1.3.7)

ShadedDensityCenter: Plot the distribution of a variable with a center region shaded

Description

Plot the distribution of a variable with a center region shaded. Annotate with the area of the shaded region.

Usage

ShadedDensityCenter(
  frame,
  xvar,
  boundaries,
  title,
  ...,
  linecolor = "darkgray",
  shading = "darkblue",
  annotate_area = TRUE
)

Arguments

frame

data frame to get values from

xvar

name of the variable to be density plotted

boundaries

vector of the min and max boundaries of the shaded region

title

title to place on plot

...

no unnamed argument, added to force named binding of later arguments.

linecolor

color of density curve

shading

color of shaded region and boundaries

annotate_area

if TRUE (default), report the area of the shaded region

See Also

ShadedDensity

Examples

Run this code

if (requireNamespace('data.table', quietly = TRUE)) {
	# don't multi-thread during CRAN checks
		data.table::setDTthreads(1)
}

set.seed(52523)
d = data.frame(meas=rnorm(100))
boundaries = c(-1.5, 1.5)
WVPlots::ShadedDensityCenter(d, "meas", boundaries,
                       title="Example center-shaded density plot")

Run the code above in your browser using DataLab