div_gauge_plot: Uses ggplot2 to produce a gauge plot in RAG colour

Description Usage Arguments Value Examples

View source: R/div_gauge_plot.R

Description

This function produces one or more gauge plots coloured in red (R), amber (A) or green (G) for a value between 0 and 1.

Usage

1
div_gauge_plot(df, breaks = c(0, 0.8, 0.95, 1), ncol = NULL, nbrSize = 6)

Arguments

df

tibble, a tibble with columns "value" and "label" (value = the values between 0 and 1; - label = text to show e.g. paste("group", colnames(t)))

breaks

numeric vector with the lower limit, the border between green and amber, the border between amber and red, and the upper limit

ncol

numeric, the number of columns to produce

nbrSize

numeric, the font size for the label

Value

ggplot object

Examples

1
2
3
4
5
d <- div_fake_team()
tbl_gender_div <- table(d$gender, d$grade) %>%
   apply(2, diversity, prior = c(50.2, 49.8)) %>%
   tibble(value = ., label = paste("Grade", names(.)))
div_gauge_plot(tbl_gender_div, ncol = 2, nbrSize = 4)

div documentation built on May 6, 2021, 9:06 a.m.

Related to div_gauge_plot in div...