div_gauge_plot {div}R Documentation

Uses ggplot2 to produce a gauge plot in RAG colour

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

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

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)

[Package div version 0.3.1 Index]