stacked_bar_with_right_labels: Stacked charts with labels at right

Description Usage Arguments Value Examples

Description

Stacked charts with labels at right

Usage

1
2
3
4
5
6
stacked_bar_with_right_labels(.data, geom = "bar", barwidth,
  verbose = FALSE, right_margin = 0.5, reverse = FALSE,
  scale_fill_manual_args, scale_y_args, x_continuous = FALSE,
  scale_x_args, coord_cartesian_args, text_family = NULL, Annotate_Args,
  theme_grattan.args, theme.args, nudge_up = 0, nudge_right = 0.5,
  extra_left_spaces = 0L)

Arguments

.data

A data frame, containing entries for x, y, and fill. x and fill must be ordered factors.

geom

The type of chart ("bar", "area").

barwidth

Passed to the width argument of geom_bar

verbose

Report the margin used (in grid:: 'lines').

right_margin

The amount of padding at right to use. The whole point of this function is to select a good right margin to allow space. But if the margin provided is wrong, it can be changed manually here.

reverse

(logical) Use the reverse palette.

scale_fill_manual_args

Arguments passed to ggplot2::scale_fill_manual.

scale_y_args

A list of arguments passed to r ggplot2::scale_y_continuous.

x_continuous

Should the x axis be continuous?

scale_x_args

A list of arguments passed to ggplot2::scale_x_discrete. If x_continuous, then the arguments passed to ggplot2::scale_x_continuous.

coord_cartesian_args

A list of arguments passed to ggplot2::coord_cartesian.

text_family

Text family for theme and geom text.

Annotate_Args

A list of list of arguments passed to ggplot2::annotate. Each element of the top-level list is an additional layer of annotate.

theme_grattan.args

Arguments passed to theme_hugh, an alias for theme_grattan. (For example, the base_size.)

theme.args

A list of arguments passed to ggplot2::theme.

nudge_up

A numeric vector to be added every text y-coordinate.

nudge_right

Move text right in units of x.

extra_left_spaces

Number of space characters " " preceding the text labels. Extra space characters are added before every newline.

Value

A chart with the labels in the right gutter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(data.table)
dat <- data.table::CJ(
  x = factor(1:10, ordered = TRUE),
  fill = factor(c("A long but not\ntoo long label", letters[2:3]),
                levels = c("A long but not\ntoo long label", letters[2:3]),
                ordered = TRUE)
) 
dat$y <- abs(rnorm(1:nrow(dat)))

stacked_bar_with_right_labels(dat)

HughParsonage/grattanCharts documentation built on May 8, 2019, 10:52 a.m.