Some change / some test

This commit is contained in:
gnoblet 2022-07-10 19:17:44 -04:00
parent bdee722ce1
commit 86390b609a
7 changed files with 4 additions and 60 deletions

View file

@ -11,19 +11,16 @@
#' @param y_title The y scale title. Default to empty string
#' @param group_title The group legend title. Defaut to NULL
#' @param font_family The font family. Default to "Leelawadee"
#' @param font_size Body font size; default to 12
#' @param position Should the chart be stacked? Default to dodge
#' @param reverse Boolean indicating whether the color palette should be reversed
#' @param title Plot title. Default to empty string
#' @param subtitle Plot subtitle. Default to empty string
#' @param title_font_size Default to 16
#' @param subtitle_font_size Default to 14
#' @param ... Other arguments to be passed to "ggblanket::gg_col"
#'
#' @return A horizontal bar chart
#'
#' @export
hbar <- function(.tbl, x, y, group = NULL, initiative = "reach", pal = "primary", width = 0.5, x_title = "", y_title = "", group_title = NULL, font_family = "Leelawadee", font_size = 12, position = "dodge", reverse = FALSE, title = "", subtitle = "", title_font_size = 16, subtitle_font_size = 14, ...){
hbar <- function(.tbl, x, y, group = NULL, initiative = "reach", pal = "primary", width = 0.5, x_title = "", y_title = "", group_title = NULL, font_family = "Leelawadee", position = "dodge", reverse = FALSE, title = "", subtitle = "", ...){
if (!(initiative %in% c("reach", "agora", "impact"))) rlang::abort(c("Wrong `initiative` arg", "*" = paste0("Arg `initiative` cannot be: ", initiative), "i" = "It must be one of 'reach' or 'agora' or 'impact'"))
@ -57,7 +54,6 @@ hbar <- function(.tbl, x, y, group = NULL, initiative = "reach", pal = "primary"
ggblanket::gg_col(x = {{ x }},
y = {{ y }},
col = {{ group }},
theme = ggblanket::gg_theme(font = font_family, pal_title = main_col),
x_title = x_title,
y_title = y_title,
col_title = group_title,
@ -89,19 +85,16 @@ hbar <- function(.tbl, x, y, group = NULL, initiative = "reach", pal = "primary"
#' @param y_title The y scale title. Default to empty string
#' @param group_title The group legend title. Defaut to NULL
#' @param font_family The font family. Default to "Leelawadee"
#' @param font_size Body font size; default to 12
#' @param position Should the chart be stacked? Default to dodge
#' @param reverse Boolean indicating whether the color palette should be reversed
#' @param title Plot title. Default to empty string
#' @param subtitle Plot subtitle. Default to empty string
#' @param title_font_size Default to 16
#' @param subtitle_font_size Default to 14
#' @param ... Other arguments to be passed to "ggblanket::gg_col"
#'
#' @return A horizontal bar chart
#'
#' @export
hbar_percent <- function(.tbl, x, y, group = NULL, initiative = "reach", pal = "primary", width = 0.5, x_title = "", y_title = "", group_title = NULL, font_family = "Leelawadee", font_size = 12, position = "dodge", reverse = FALSE, title = "", subtitle = "", title_font_size = 16, subtitle_font_size = 14, ...){
hbar_percent <- function(.tbl, x, y, group = NULL, initiative = "reach", pal = "primary", width = 0.5, x_title = "", y_title = "", group_title = NULL, font_family = "Leelawadee", position = "dodge", reverse = FALSE, title = "", subtitle = "", ...){
if (!(initiative %in% c("reach", "agora", "impact"))) rlang::abort(c("Wrong `initiative` arg", "*" = paste0("Arg `initiative` cannot be: ", initiative), "i" = "It must be one of 'reach' or 'agora' or 'impact'"))
@ -135,7 +128,6 @@ hbar_percent <- function(.tbl, x, y, group = NULL, initiative = "reach", pal = "
ggblanket::gg_col(x = {{ x }},
y = {{ y }},
col = {{ group }},
theme = ggblanket::gg_theme(font = font_family, pal_title = main_col, size_body = font_size, size_title = title_font_size, size_subtitle = subtitle_font_size),
x_title = x_title,
y_title = y_title,
col_title = group_title,