create.stacked.barplot: Create a stacked barplot.

Description Usage Arguments Value Author(s) Examples

View source: R/create.stacked.barplot.R

Description

Create a barplot with a fill variable to show a stacked barplot.

Usage

1
create.stacked.barplot(filename = NULL, x = NULL, fill = NULL, data, rotate = FALSE, width = 0.9, xlab = NULL, ylab = NULL, xaxis.log.scale = FALSE, yaxis.log.scale = FALSE, show.legend = TRUE, group.by = NULL, group = 'row', theme = NULL, resolution = 900)

Arguments

filename

Name of file to write plot to, if NULL is provided the plots displays to STDOUT (default: NULL)

x

The value for the x-axis (required)

fill

The value to fill the bars (required)

data

The dataframe containing the data for the plot (required)

rotate

A boolean variable to rotate the barplot (default: FALSE)

width

Defines the width of the bars (default: 0.9)

xlab

The label for the x-axis (default: NULL)

ylab

The label for the y-axis (default: NULL)

xaxis.log.scale

BOOLEAN to set xaxis to log scale (default: FALSE)

yaxis.log.scale

BOOLEAN to set yaxis to log scale (default: FALSE)

show.legend

A boolean to determine whether to show or hide the legend (default: TRUE)

group.by

Dataframe element to use in facet_grid() to group bars (default: NULL)

group

Group by 'row' or 'col', (default: row)

theme

Theme function for plot (default: NULL)

resolution

Resolution of plot (default: 900)

Value

Returns a ggplot object.

Author(s)

Richard de Borja <richard.deborja@sickkids.ca>

Examples

1
create.stacked.barplot(data = diamonds, x = 'clarity', width = 0.9, fill = 'cut', xlab = 'Diamond Clarity', ylab = 'Count', show.legend = FALSE)

rdeborja/plotting.general documentation built on May 27, 2019, 3:05 a.m.