ggBar.plot: Bar Plots of Percentages with ggplot2

Description Usage Arguments Author(s) See Also Examples

View source: R/ggBar.plot.R

Description

Create bar plot of proportions of data with counts superimposed over the bars. Plots the proportions of each level of y per level of x.

Usage

1
2
3
4
5
ggBar.plot(data, x, y, facet = NULL, ...)
## Default S3 method:
ggBar.plot(data, x, y, facet = NULL, percent = TRUE,
	facet.cols = NULL, scales = "fixed",
	width = 0.7, size = 5, opp.cols = FALSE)

Arguments

data

a dataframe

x

Unquoted variable name. The column in data containing factor whose levels will be plotted on the x-axis.

y

Unquoted variable name. The column in data containing factor whose proportions will be represented by the bars.

facet

character vector containing name(s) of one or two additional factors in data by which the plot will be faceted.

percent

logical. Should y axis display percentages (rather than proportions)?

facet.cols

numeric. Number of columns in display of faceted plots.

scales

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

width

numeric. Width of bars in plots.

size

numeric. Size of text for counts.

opp.cols

logical. Should colors of counts be different (white and black)? Intended for use with darker colors in bars.

...

additional options.

Author(s)

Jason Grafmiller

See Also

See Also ggplot2, geom_bar.

Examples

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

## plot the percentages of s- vs. of-genitives by genre
ggBar.plot(brown_genitives, Genre, Type)

## plot the percentages of s- vs. of-genitives by
## genre and possessor animacy
ggBar.plot(brown_genitives, Genre, Type,
	facet = "PossrAnimacyBin")

## plot the percentages of s- vs. of-genitives by
## genre, possessor animacy and possessum animacy
ggBar.plot(brown_genitives, Genre, Type,
	facet = c("PossrAnimacyBin", "PossmAnimacyBin")

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