Skip to contents

Wrapper around stem_plot() to make creating barplots easier.

Usage

stem_plot_bar(
  data,
  item,
  group = NULL,
  weight = NULL,
  scale_y = ggplot2::scale_y_continuous(labels = scales::percent_format(accuracy = 1,
    suffix = " %"), limits = c(0, NA)),
  label = TRUE,
  label_scale = 100,
  label_hide = 0,
  ...
)

Arguments

data

Dataframe including item (and group) variables

item

Plotted item

group

Optional; plotted grouping variable

weight

Optional; survey weights

scale_y

Format y axis using ggplot2::scale_y_continuous()

label

Should geom labels be printed? Yes by default

label_scale

Multiplicative scale of geom labels. 100 multiple the values by 100

label_hide

Hides geom labels with values smaller than this threshold. Defaults to 0.

...

Other arguments passed to stem_plot()

Value

A ggplot2 object with custom attribute "stem_plot"

Examples

if (FALSE) { # \dontrun{
stem_plot_bar(trust, government)
} # }