ggDensity.plot: Histogram and Density Curve Plots of Continuous Variable with...

Description Usage Arguments Author(s) See Also Examples

View source: R/ggDensity.plot.R

Description

Create density histogram of data with a density curve overlay using ggplot2.

Usage

1
2
3
4
5
ggDensity.plot(data, y, facet = NULL, fill.col = NULL, line.col = "black",
	scales = "fixed",
	bin.width = NULL, add.line = T,
	alpha.h = 1, alpha.d = .2,
	fill.d = "blue")

Arguments

data

a dataframe

y

Unquoted variable name of the column in data whose values will be plotted.

facet

a character vector of one or two additional factor names by which the plot will be faceted.

fill.col

a character vector specifying the fill color of the histogram bars. Default is "lightgray".

line.col

a character vector specifying the line color of the histogram bars. Default is black. Specify line.col = F to suppress line colors.

scales

a character vector specifying whether scales should be fixed across facets. Values are "fixed", or "free".

bin.width

a numeric vector specifying the width of histogram bins.

add.line

logical. Should density curve be added to histogram? Default is TRUE.

alpha.h

a numeric value between (0, 1) determining the transparency of histogram bars (1 = fully opaque).

alpha.l

a numeric value between (0, 1) determining the transparency of filled area under the density curve (1 = fully opaque).

fill.d

a character vector specifying the color of the filled area under the density curve. Specify fill.d = F to suppress fill color.

Author(s)

Jason Grafmiller

See Also

See Also ggplot2, geom_histogram, geom_density, stat_bin.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(brown_genitives)

## plot the distribution of type-token ratios by genre
ggDensity.plot(brown_genitives, TypeTokenRatio)

## plot the distribution of type-token ratios by
## construction type
ggDensity.plot(brown_genitives, TypeTokenRatio,
	facet = "Type")

## plot the distribution of type-token ratios by
## construction type and genre
ggDensity.plot(brown_genitives, TypeTokenRatio,
	facet = c("Type", "Genre"))

jasongraf1/JGggplot documentation built on May 29, 2019, 11:43 a.m.