Skip to contents

This function extends ggiraph::girafe by allowing colour palettes to be globally specified.

Usage

girafe(
  ggobj,
  ...,
  char_limit = 200,
  label_wrap_width = 80,
  interactive = TRUE,
  palette_codes = NULL,
  priority_palette_codes = NULL,
  ncol = NULL,
  byrow = TRUE,
  colour_2nd_binary_cat = NULL,
  checked = NULL,
  not_checked = NULL,
  width_svg = NULL,
  height_svg = NULL,
  pointsize = 12
)

Arguments

ggobj

ggplot2-object.

...

Dots forwarded to ggiraph::girafe()

char_limit

Integer. Number of characters to fit on a line of plot (legend-space). Will be replaced in the future with a function that guesses this.

label_wrap_width

Integer. Number of characters fit on the axis text space before wrapping.

interactive

Boolean. Whether to produce a ggiraph-plot with interactivity (defaults to TRUE) or a static ggplot2-plot.

palette_codes

Optional list of character vectors. Each vector contains colours. Vectors can optionally be named, where names are categories and values are colours. The final character vector of the list is used as a fallback. Defaults to NULL.

priority_palette_codes

Optional named character of categories (as names) with corresponding colours (as values) which are used first, whereupon the remaining unspecified categories are pulled from the last vector of palette_codes. Defaults to NULL.

ncol

Optional integer or NULL.

byrow

Whether to display legend keys by row or by column.

colour_2nd_binary_cat

Optional string. Color for the second category in binary checkbox plots. When set together with checked and not_checked, reverses the category order so that not_checked appears second and receives this color. Ignored if checkbox criteria are not met.

checked, not_checked

Optional string. If specified and the fill categories of the plot matches these, a special plot is returned where not_checked is hidden. Its usefulness comes in plots which are intended for checkbox responses where unchecked is not always a conscious choice.

pointsize, height_svg, width_svg

See ggiraph::girafe().

Value

If interactive, only side-effect of generating ggiraph-plot. If interactive=FALSE, returns modified ggobj.

Examples

plot <- makeme(data = ex_survey, dep = b_1)
girafe(plot)